Giter Site home page Giter Site logo

Comments (8)

JasonGross avatar JasonGross commented on May 26, 2024 1

Here is some code that runs correctly before stripping trailing spaces, but fails after stripping them:

Require Import Coq.Strings.String.
Definition foo := "    
"%string.
Check eq_refl : String.length foo = 5.

from pg.

Matafou avatar Matafou commented on May 26, 2024

Let us try this for a while and see.

While you ar at it, indenting should not rewind either.

Spaces are (very) significant when following a dot ([Foo. bar] is different
than [Foo.bar]). To my knoledge (and excepting strange stuff with notation
maybe) this is the only significant space.

P.

2015-10-09 1:06 GMT+02:00 Clément Pit--Claudel [email protected]:

In most cases (in all?), removing extra whitespace at the end of a line
shouldn't require rewinding; even outside of comments. Yet at the moment
calling whitespace-cleanup will cause PG to rewind to the earliest point
where some space was removed.

This is a bit frustrating, so I'd like to push a patch to suppress the
rewinding behaviour when removing space at the end of the line. Are there
objections?

Also, what should be the proper behaviour? Do we allow insertion of spaces
as well? Only at the end of lines? Or anywhere outside of strings and
outside of symbols? (is space significant anywhere in Coq?)


Reply to this email directly or view it on GitHub
#4.

from pg.

cpitclaudel avatar cpitclaudel commented on May 26, 2024

Some notes after having a quick look: this isn't trivial, because retracting is implemented as a before-change hook, which doesn't convey information on the text about to be inserted or deleted. Using an after-change-hook would work better.

Interesting functions to look at: span-write-warning and proof-span-read-only and proof-retract-before-change.

from pg.

Matafou avatar Matafou commented on May 26, 2024

Writing seems more difficult before setting readonly off than before indeed!
P.

Le lundi 23 novembre 2015, Clément Pit--Claudel [email protected]
a écrit :

Some notes after having a quick look: this isn't trivial, because
retracting is implemented as a before-change hook, which doesn't convey
information on the text about to be inserted or deleted. Using an
after-change-hook would work better.

Interesting functions to look at: span-write-warning and
proof-span-read-only and proof-retract-before-change.


Reply to this email directly or view it on GitHub
#4 (comment).

from pg.

JasonGross avatar JasonGross commented on May 26, 2024

Outside of string literals, I believe that Coq treats one whitespace character the same as any positive number of whitespace characters. So adding or removing whitespace at a location bordered by whitespace (and a newline counts as whitespace) should be safe as long as you're not in the middle of a string literal (and these are used in format modifiers for notations, too). (Dots are not special in that whitespace around them matters (in some sense, other characters are special in that whitespace around them usually does not matter); e.g., f oo is very different from foo.)

from pg.

cpitclaudel avatar cpitclaudel commented on May 26, 2024

Spaces in strings are a good point, thanks! There are technical challenges with this due to the way retraction is implemented though, so I'm not sure when or if it will happen.

from pg.

JasonGross avatar JasonGross commented on May 26, 2024

Note that undo (C-/) edits arbitrary regions without retraction (incorrectly!), so, in some sense, there must be a way to bypass retraction, no?

from pg.

cpitclaudel avatar cpitclaudel commented on May 26, 2024

Undo reverts fine for me. Are you using an undo package? If not, can you post a recipe?

There's definitely a way to bypass restriction (it's used, for example, when you edit text inside a comment); the hard part is deciding when to bypass it.

from pg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.