summaryrefslogtreecommitdiff
path: root/sys/src/cmd/acme/acme.c
AgeCommit message (Collapse)Author
2022-01-04acme: fix window and scrollbar display glitches at bottom fringe of columnIgor Böhm
The following patch fixes acme display glitches at the bottom fringe of columns when adding/moving/resizing windows. Here an example of an easy to reproduce case: • https://invidio.xamh.de/watch?v=iLekQrxycaM …opening acme and resizing a column to the right is all that is needed. The functions winresize(…) and textresize(…) are extended with an additional parameter `fillfringe` to indicate if a window/tag shall fill a potential fringe area that would otherwise remain white. The changes have been inspired by the approach taken in plan9port acme.
2021-11-05acme: fix leaking memory allocated by getenv("font")Igor Böhm
If the font chosen for acme is retrieved via `getenv("font")` its memory is leaked: <snip> if(fontnames[0] == nil) fontnames[0] = getenv("font"); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > getenv(…) mallocs memory if(fontnames[0] == nil) fontnames[0] = "/lib/font/bit/vga/unicode.font"; if(access(fontnames[0], 0) < 0){ fprint(2, "acme: can't access %s: %r\n", fontnames[0]); exits("font open"); } if(fontnames[1] == nil) fontnames[1] = fontnames[0]; fontnames[0] = estrdup(fontnames[0]); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > if the `getenv("font")` path was taken above, this assignment > will leak its memory. </snap> The following leak/acid session demonstrates the issue: <snip> cpu% leak -s 212252 src(0x002000cb); // 1 cpu% acid 212252 /proc/212252/text:amd64 plan 9 executable /sys/lib/acid/port /sys/lib/acid/amd64 acid: src(0x002000cb) /sys/src/cmd/acme/acme.c:107 102 fprint(2, "usage: acme [-aib] [-c ncol] [-f font] [-F fixedfont] [-l loadfile | file...]\n"); 103 exits("usage"); 104 }ARGEND 105 106 if(fontnames[0] == nil) >107 fontnames[0] = getenv("font"); 108 if(fontnames[0] == nil) 109 fontnames[0] = "/lib/font/bit/vga/unicode.font"; 110 if(access(fontnames[0], 0) < 0){ 111 fprint(2, "acme: can't access %s: %r\n", fontnames[0]); 112 exits("font open"); acid: </snap> The fix tries to first check if a font has been set via command line options in which case the font string is malloced via estrdup(…). If no font has been selected on the command line getenv("font") is used. If no getenv("font") var is found we malloc a default font via estrdup(…). <snip> if(fontnames[0] != nil) fontnames[0] = estrdup(fontnames[0]); else if((fontnames[0] = getenv("font")) == nil) fontnames[0] = estrdup("/lib/font/bit/vga/unicode.font"); if(access(fontnames[0], 0) < 0){ fprint(2, "acme: can't access %s: %r\n", fontnames[0]); exits("font open"); } if(fontnames[1] == nil) fontnames[1] = fontnames[0]; fontnames[1] = estrdup(fontnames[1]); </snap> This resolves the memory leak reported by leak(1).
2021-10-06acme: don't let tag button draw over tag border.james palmer
2020-12-19acme: use global user string variable instead of getuser()cinap_lenrek
2020-09-29acme: revert stray changesOri Bernstein
forgot I had local changes when testing, re-revert scrolling.
2020-09-22acme: import changes from plan9port (thanks jxy)Ori Bernstein
Import the following improvements and bugfixes from plan9port: 4650064a acme: scale window bodies on resize, not including tag space d28913a9 acme: save/restore multiline tags in Dump/Load d2df5d6c acme: fix crash in X |cat with multiple windows 3d6e5cb5 acme: preserve window position and selection during Get
2020-08-03acme: reverting scroll change, causes continuous scrolling with scrollwheelcinap_lenrek
2020-06-11acme: implement position-dependent scroll-wheel scrollingkvik
This brings acme scrolling behaviour in line with that of 9front's rio and sam, where the amount scrolled varies with a vertical position of the pointer within the window, similar to how the scrollbar works. At some point it would be good to implement a line-at-a-time scrolling when the Shift key is pressed, as seen in rio. For this to happen the acme keyboard input needs to be rewritten in terms of /dev/kbd instead of relying on keyboard(2) -- that is, the /dev/cons interface.
2020-06-06acme: import event log from plan9port (thanks fshahriar)Ori Bernstein
Based off the following 3 commits: 4a3fb87264f8bc03fc62f00ef335056f30d18023 45f8ba54143323f08a21343633764caa59aa3ea3 fdf6ef333705c844bcf3ccf2f93b2773f1a6aa41 Reading /mnt/acme/log reports a log of window create, put, focus, 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.
2020-05-10acme: add missed error checkskvik
2020-01-31fix double free in acme.Ori Bernstein
in acmerrorproc(): sendp(s); free(s); in waitthread(): recv(&err) free(err) We only want waitthread to free.
2019-12-06fix some acme memory leaksOri Bernstein
(imported from plan9port 7ca1c90109e17dced4b38fbaadea9d2cf39871b7, some tag restoration lines not relevant.)
2018-08-01acme: add spacesindent modespew
2016-11-17cmd: remove a bit of unused stuffftrvxmtrx
2013-09-11acme: use threadexitsall() to tear down mouse and keyboard procs on errorcinap_lenrek
2012-03-21vga: fix type in vga.font, make vga/unicode.font filecinap_lenrek
2011-12-09acme: use $font if set, default to vga fontcinap_lenrek
2011-03-30Import sources from 2011-03-30 iso image - libTaru Karttunen
2011-03-30Import sources from 2011-03-30 iso imageTaru Karttunen