aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/acme
AgeCommit message (Collapse)AuthorFilesLines
2020-05-18acme: avoid global named "class"Russ Cox1-0/+3
For AIX.
2020-03-30acme: scale window bodies on resize, not including tag spaceRuss Cox1-3/+5
This avoids reopening collapsed windows after a large vertical resize.
2020-01-24acme: report close failure in Put, this time for sureRuss Cox1-5/+5
Missed in 0b349f6f that Bterm is not closing fd.
2020-01-14acme: save/restore multiline tags in Dump/LoadRuss Cox1-4/+16
The dump substitutes each \n in a multiline tag with a 0xff byte. Since it is not valid UTF it cannot occur in an ordinary dump file. Old acmes will just read it in as an error rune. Fixes #135. Fixes #153.
2020-01-13acme: fix buffer overflow introduced in parsetag refactorRuss Cox3-8/+8
2020-01-13acme: fix movetodel for spaces in file namesRuss Cox1-11/+8
2020-01-13acme: allow spaces in window namesRuss Cox2-5/+20
There are many things we could do to make this work. an environment variable to control the character. Another option would be to use U+00A0 (non-breaking space), which renders the same as space. This change avoids changing the separator character and instead assumes that if the left side of the tag already ends in " Del Snarf |" then what comes before that is the file name. Acme already aggressively preserves the "Del Snarf |", so this should work decently well as a stop-gap. We can always try something else later. Fixes #26. Fixes #104. Fixes #329.
2020-01-13acme: one more place to use parsetagRuss Cox1-5/+1
2020-01-13acme: factor out tag parsing codeRuss Cox3-21/+28
2020-01-13acme: fix crash in X |cat with multiple windowsRuss Cox1-5/+24
Fixes #9. Fixes #219. Fixes #222. Fixes #330.
2020-01-10Trivial changes: whitespace and modes.Dan Cross17-133/+129
Remote whitespace at the ends of lines. Remove blank lines from the ends of files. Change modes on source files so that they are not executable. Signed-off-by: Dan Cross <cross@gajendra.net>
2020-01-02acme: do not pass null pointers where disallowedNeven Sajko2-1/+4
The C standards disallow passing null pointers to memmove and memcmp. Change-Id: I1c88c2adbc32a23ef742f206038b8f7c4e0540c7
2019-12-19acme: report close failure during PutRuss Cox1-2/+6
2019-06-10acme: accept expanded URLs in lookRuss Cox1-9/+39
Just as look expands a click in /etc/passwd to the full name (provided that file exists), it now expands a click in https://9fans.net/ to the full URL (provided the prefix is http:// or https://). Probably more adjustment is needed.
2019-05-17acme: delete trailing spaces during Put in autoindent modeRuss Cox1-41/+64
Autoident mode is the leading cause of trailing spaces on lines. Remove them during Put to make various picky tools happier. The changes during Put are added as a separate entry to the file history, so that the first Undo after Put restores the spaces.
2019-04-19acme: do not trim spaces during PutRuss Cox1-4/+8
The commit that introduced this was pushed accidentally. It is not a good idea to do this. (It breaks programs that think that a clean window means the body matches the on-disk file.)
2019-04-05acme: Update tag after receiving menu/nomenu control event (#251)Martin Kühl1-0/+2
2019-02-01acme: drop trailing spaces during Put of auto-indent windowRuss Cox1-3/+38
Auto-indent mode leaves trailing spaces on blank lines as you type past them, so silently elide them from the window content as it gets written back to disk. Another option would be to remove them from the window entirely during Put, but they're actually nice to have while editing, and to date Put has never modified the window content.
2018-11-15acme: add 32x32 boxcursorRuss Cox4-2/+71
The only difference from the upscaled 16x16 is a one-pixel adjustment in the offset position, but this at least exercises setcursor2.
2018-11-13acme: avoid division by zero when resizing col (#189)Fazlul Shahriar1-2/+6
To reproduce, create a column with at least two windows and resize acme to have almost zero height.
2018-09-19acme: Apply each -/+ only once (#156)Martin Kühl1-3/+3
When plumbing an address like `3-`, Acme selects line 1, and similarly `3+` selects line 5. The same problem can be observed for character addresses (`#123+`) but _not_ for ones like `+`, `.+` or `/foo/+`: The problem only occurs when a number is followed by a direction (`-`/`+`). Following along with the example `3-` through `address` (in addr.c): We read `3` into `c` and match the `case` on line 239. The `while` loop on line 242ff reads additional digits into `c` and puts the first non-digit back by decrementing the index `q`. Then we find the range for line 3 on line 251 and continue. On the next iteration, we set `prevc` to the last `c`, but since that part read ahead _into `c`_, `c` is currently the _next_ character we will read, `-`, and now `prevc` is too. Then in the case block (line 210) the condition on line 211 holds and Acme believes that it has read two `-` in sequence and modifies the range to account for the “first” `-`. The “second” `-` gets applied after the loop is done, on line 292. So the general problem is: While reading numbers, Acme reads the next character after the number into `c`. It decrements the counter to ensure it will read it again on the next iteration, but it still uses it to update `prevc`. This change solves the problem by reading digits into `nc` instead. This variable is used to similar effect in the block for directions (line 212) and fills the role of “local `c` that we can safely use to read ahead” nicely.
2018-03-27acme: fix some memory leaksXiao-Yong Jin3-2/+8
2017-11-02acme: preserve window position and selection during GetRuss Cox5-18/+103
Before, executing Get in a file rewound the window offset and selection to the start of the file. After this CL, Get preserves the window offset and selection, where preserve is defined as "the same line number and rune offset within the line". So if the window started at line 10 before and the selection was line 13 chars 5-7, then that will still be true after Get, provided the new content is large enough. This should help the common situation of plumbing a compiler error, realizing the window is out of date, clicking Get, and then losing the positioning from the plumb operation.
2017-10-14acme: free buf in checksha1Russ Cox1-0/+1
Thanks to Lorenzo Beretta for noticing.
2017-10-10acme: check file content before declaring file "modified since last read"Russ Cox23-13/+79
Bad remote file systems can change mtime unexpectedly, and then there is the problem that git rebase and similar operations like to change the files and then change them back, modifying the mtimes but not the content. Avoid spurious Put errors on both of those by checking file content. (False positive "modified since last read" make the real ones difficult to notice.)
2017-07-16acme: implement Cmd-Shift-Z for Redo on MacRuss Cox1-0/+4
Change-Id: Ie9332ed473609bd6ca156be0843dc5411cbf7b93 Reviewed-on: https://plan9port-review.googlesource.com/2941 Reviewed-by: Russ Cox <rsc@swtch.com>
2017-01-06all: fix or silence all INSTALL warnings on macOSRuss Cox1-1/+1
Should be a clean build now. Change-Id: Id3460371cb5e8d4071f8faa9c2aec870d213a067 Reviewed-on: https://plan9port-review.googlesource.com/2781 Reviewed-by: Russ Cox <rsc@swtch.com>
2015-06-03acme: add focus change to logSergiusz Urbaniak1-0/+6
Currently new, put and del events are being logged. This patch adds a focus event to the log whenever the user changes the focus to another window. This lets programs react to files being edited in acme without the need of being restarted. Change-Id: Idf35c0d7dbfca30e79724dc9f49e44c6a4eb6a1e Reviewed-on: https://plan9port-review.googlesource.com/1140 Reviewed-by: Russ Cox <rsc@google.com>
2014-12-02libdraw, libframe, acme: fix, guard against inverted range in textsetselectRuss Cox1-3/+9
Credit to Roi Martin <jroi.martin@gmail.com> for noticing that libdraw was being passed a negative string length and for finding the sequence of keystrokes that make acme do it reproducibly. Change-Id: If3f3d04a25c506175f740d3e887d5d83b5cd1bfe Reviewed-on: https://plan9port-review.googlesource.com/1092 Reviewed-by: Russ Cox <rsc@swtch.com>
2014-06-03acme: fix bufread crash due to typing-point scrollingRuss Cox1-0/+4
Acme tracks the most recent typing insertion point and the home and end keys stop there on their way up to the top or down to the bottom of the file. That point should be iq1, and it should be adjusted properly so that it's always between 0 and t->file->b.nc inclusive. (This is all code from an external contributor, years old at this point but new since Plan 9.) Somehow, sometimes iq1 ends up a little beyond b.nc, and when passed to textbacknl it crashes acme in bufread. I can't see how that can happen but if it does, avoid the crash. It's tempting to pull the insertion point code out entirely but this is a little less invasive and should fix things for now. TBR=rsc https://codereview.appspot.com/107730043
2014-06-03acme: increase timer resolution to 10msRuss Cox1-1/+1
We ran for a long time with 10ms kernel resolution, so 10ms user space resolution here should be fine. Some systems actually provide 1ms sleeps, which makes this polling use a bit more cpu than we'd like. Since the timers are for user-visible things, 10ms should still be far from noticeable. Reduces acme's cpu usage on Macs when plumber is missing (and plumbproc is sleeping waiting for it to appear). LGTM=aram, r R=r, aram https://codereview.appspot.com/99570043
2014-05-19undo CL 69070045 / 8539a916d98aRuss Cox1-4/+0
This breaks ^C in win windows, as expected. People use ^C, win expects and handles ^C, so I don't think we can just take it away. I've noticed that it is broken but assumed my ssh was screwed up. If you want to make WindowsKey+C,X,V do the operations, by analogy with command+C,X,V on Mac, that's fine with me. ««« original CL description acme: copy/cut/paste with ctl+c,x,v LGTM=rsc R=rsc CC=plan9port.codebot https://codereview.appspot.com/69070045 »»» TBR=rsc CC=burns.ethan, r https://codereview.appspot.com/96410045
2014-05-05acme: fix two flush bugs in new log fileRuss Cox1-2/+3
TBR=rsc https://codereview.appspot.com/95010048
2014-04-30acme: add log file in acme root directoryRuss Cox11-6/+236
Reading /mnt/acme/log reports a log of window create, put, and delete events, as they happen. It blocks until the next event is available. Example log output: 8 new /Users/rsc/foo.go 8 put /Users/rsc/foo.go 8 del /Users/rsc/foo.go This lets acme-aware programs react to file writes, for example compiling code, running a test, or updating an import block. TBR=r R=r https://codereview.appspot.com/89560044
2014-04-19acme: add comment for aligned writesRuss Cox1-0/+5
TBR=r https://codereview.appspot.com/89510044
2014-04-19acme: use buffered i/o to write fileRuss Cox1-1/+16
Bakul Shah has observed corrupted files being written when acme writes over osxfuse to sshfs to a remote file system. In one example we examined, acme is writing an 0xf03-byte file in two system calls, first an 0x806-byte write and then a 0x6fd-byte write. (0x806 is BUFSIZE/sizeof(Rune); this file has no multibyte UTF-8.) What actually ends up happening is that an 0x806-byte file is written: 0x000-0x6fd contains what should be 0x806-0xf03 0x6fd-0x7fa contains zeros 0x7fa-0x806 contains what should be 0x7fa-0x806 (correct!) The theory is that fuse or sshfs or perhaps the remote file server is mishandling the unaligned writes. acme does not seem to be at fault. Using bio here will make the writes align to 8K boundaries, avoiding the bugs in whatever underlying piece is broken. TBR=r https://codereview.appspot.com/89550043
2014-04-18acme: fix Get of dir in nameless window (thanks Colton Lewis)Russ Cox1-1/+1
TBR=r https://codereview.appspot.com/89390043
2014-03-13acme: copy/cut/paste with ctl+c,x,vEthan Burns1-0/+4
LGTM=rsc R=rsc CC=plan9port.codebot https://codereview.appspot.com/69070045
2014-03-13acme, sam: handle >1GB files correctlyRuss Cox2-2/+5
TBR=rsc https://codereview.appspot.com/74060043
2013-10-22acme: scroll a directory window when navigating if:Rob Pike1-1/+17
- the cursor is on the last line - the navigation would put the cursor over the tag of the following text R=rsc CC=smckean83 https://codereview.appspot.com/15280045
2013-09-06acme: execute commands with / using shellMarius Eriksen1-1/+1
This allows commands in bin subdirectories. R=rsc CC=plan9port.codebot https://codereview.appspot.com/13254044
2013-09-06acme Mail: add Search commandAkshat Kumar2-1/+63
Introduces the Search command for mailboxes. Arguments passed are treated as one space- separated string, passed on to mailfs' IMAP search interface. R=rsc, david.ducolombier CC=plan9port.codebot https://codereview.appspot.com/13238044
2013-09-06mailfs: allow spaces in box nameAkshat Kumar1-1/+16
Mail services (such as Google Mail) will often have directories with names that contain spaces. Acme does not support spaces in window names. So, replace spaces in mail directory names with the Unicode character for visible space. The code is a bit of an over-approximation and generally non-optimal. R=rsc, david.ducolombier, 0intro CC=plan9port.codebot https://codereview.appspot.com/13010048
2013-07-31acme: allow :6 in 5-line fileRuss Cox1-0/+2
R=rsc https://codereview.appspot.com/12162043
2012-11-26acme: retina scaling for scroll bars, buttonRuss Cox2-26/+34
R=rsc http://codereview.appspot.com/6854094
2012-11-25acme: set $samfile (same as $%) during executionMarius Eriksen1-0/+1
R=rsc CC=plan9port.codebot http://codereview.appspot.com/6854092
2012-10-22acme: use threadspawnd to avoid changing "." of current processRuss Cox1-29/+8
R=rsc http://codereview.appspot.com/6736060
2012-10-21acme: add $acmeshell to control execution shellMarius Eriksen3-2/+12
R=rsc CC=plan9port.codebot http://codereview.appspot.com/6614056
2012-10-20fix gcc 4.7 warnings (thanks Tuncer Ayaz)Russ Cox2-6/+2
R=rsc http://codereview.appspot.com/6744053
2012-10-05acme: correct writes of runes on auspicious byte boundariesErik Quanstrom1-23/+34
R=rsc, r CC=plan9port.codebot http://codereview.appspot.com/6586067