summaryrefslogtreecommitdiff
path: root/usr.bin/mg
AgeCommit message (Collapse)Author
2023-08-11Replace use of the old BSD st_*timespec members in struct stat withPhilip Guenther
the POSIX-standard st_*tim members. ok millert@
2023-06-28add `notab' to the list of modes that can be set with set-default-modeOmar Polo
specify also that it can be set globally with set-default-mode, as done in the description of the other built-in modes. Diff from Simon Branch (that I got via jmc@), thanks!
2023-04-28fix lfindent (newline-and-indent) comment and description in the man pageOmar Polo
for a while it has used only spaces when no-tab-mode is enabled and respected the current buffer tab width.
2023-04-28mark up all commands in the man pageOmar Polo
2023-04-25mark up `mode' in -f descriptionOmar Polo
2023-04-25document that prefix-region with a prefix argument prompts for the stringOmar Polo
2023-04-21mg: fix space_to_tabstopOmar Polo
Since the import of mg in the tree, space_to_tabstop used curbp->w_doto (the byte offset in the current line) as mean to deduce the current column for indentation. This is wrong because it doesn't account for tab, control characters and octets > 127 (which are all rendered with more than one column.) Use instead getcolpos(). ok tb@
2023-04-21mg: allow to change the tab widthOmar Polo
This makes the tab width customizable per-buffer. The new function `set-tab-width' changes it for the current buffer or the default value for new buffers if called with a prefix argument (or from the startup file.) The default tab width is still 8 column. Together with the newly resurrected no-tab-mode, allows to use mg for a variety of programming languages and coding styles. Note that it's not possible to call set-tab-width with auto-execute in the startup file due to limitations in how auto-execute and the parser work. ok tb@
2023-04-17fix buffer overflow in displaymatch(); ok/tweak tb@Omar Polo
2023-04-17fix a few dobeep_msgs() calls: a space is already added between the argumentsOmar Polo
ok tb@
2023-04-17add doindent() prototype at the start of the file; forgotten in previousOmar Polo
2023-04-17resurrect mg' no-tab-modeOmar Polo
It's a mode that makes mg insert spaces up to the next tab stop upon pressing TAB, along with the various tweaks needed in other places so for e.g. auto-indent-mode also uses spaces. This is not just an unifdef NOTAB: even under no-tab-mode mg should consider literal TAB characters wide up to the next tab stop, while the hidden code considered hard tabs to be just control character (i.e. ^I) with width of two columns. I'm also introducing the helper function doindent() in utils.c to de-obfuscate the insertion of tabs/spaces until the given column. ok tb@
2023-04-14Add a missing voidTheo Buehler
2023-03-30drop unnecessary copy of fname; ok tb@Omar Polo
2023-03-30tabify two linesOmar Polo
2023-03-30don't access(conffile)Omar Polo
This removes a few access(2) calls in the configuration file handling. startupfile() now opens and return the file and to avoid surprises it also uses a caller-provided buffer to store the filename. This also removes the extra adjustpath() that load() did: it has been moved to evalfile() only. with help, fixes and ok tb@
2023-03-30trailing whitespacesOmar Polo
2023-03-30strncpy -> strlcpy to properly NUL-terminate the copy of the pathOmar Polo
otherwise paths longer than NFILEN (1024) given with -u won't NUL-terminate `file'.
2023-03-29plug leak of tagpos in poptag() if loadbuffer() failsOmar Polo
2023-03-29drop needless global tagsfn pathOmar Polo
mg kept the path to the last loaded tag file in tagsfn which was used for both the lazy loading (now removed) and as a flag to know if any tags are currently loaded. It's redundant and complicates the code: just check if the tree is empty instead. ok tb@
2023-03-29change tagvisit (aka visit-tag-table) to immediately load the tag fileOmar Polo
before it used to only record the path to the tag file which was loaded on demand upon find-tag (M-.). tagvisit did to do a stat + access dance to know if the path was pointing to a regular, readable file and loadtags (called lazily by find-tag) trusted those checks... Instead, just load the tags in tagvisit and drop the lazy mechanics. ok tb@
2023-03-28mg: fix parsing of tag files with duplicate entriesTheo Buehler
Instead of erroring out ignore duplicates. Fixes using /var/db/libc.tags again. ok op
2023-03-28use the shell basename as argv[0] instead of hardcoding "sh"Omar Polo
Suggested by and ok millert@, thanks!
2023-03-28mg: fall back to /bin/sh if $SHELL is undefined.Omar Polo
Original diff from lux (lx [at] shellcodes [dot] org) thanks! tweaked by me; ok millert@
2023-03-27kill another empty lineOmar Polo
2023-03-27kill two empty lines and some trailing whitespacesOmar Polo
2023-03-22plug another leak in addctag; found + ok tb@Omar Polo
2023-03-22avoid memleak / crash in addctagOmar Polo
the l pointer is advanced, so if the line is malformed `goto cleanup' will free(NULL) or a pointer inside l. semplification and ok tb@
2023-03-22plug memleak in error pathOmar Polo
based on a diff by lux (lx [at] shellcodes [dot] org), thanks! Diff via, tweak and ok tb@
2023-03-22delete trailing whitespaces; no functional changeOmar Polo
2023-03-08Delete obsolete /* ARGSUSED */ lint comments.Philip Guenther
ok miod@ millert@
2022-12-26spelling fixes; from paul tagliamonteJason McIntyre
amendments to his diff are noted on tech
2022-10-20add zap-to-char and zap-up-to-char; bind zap-to-char to M-z.Omar Polo
ok florian@
2022-10-15replace ewprintf("") calls with eerase(): no functional difference.Omar Polo
ok florian@
2022-10-15typo in comment: Funtion -> FunctionOmar Polo
2022-06-28transistion -> transitionJonathan Gray
2022-05-24fix some dobeep_msgs callsop
dobeep_msgs isn't printf-like: it just prints the two arguments separated by a space. When it was introduced, some calls from ewprintf were incorrectly translated and the "%s" remained. ok florian@
2022-05-24automatically delete trailing whitespaces on RET in c-mode andop
auto-indent-mode (only after computing the auto indent.) tested also by Mikhail (thanks!). ok tb@
2022-03-31man pages: add missing commas between subordinate and main clausesChristian Weisgerber
jmc@ dislikes a comma before "then" in a conditional, so leave those untouched. ok jmc@
2022-01-28When it's the possessive of 'it', it's spelled "its", without thePhilip Guenther
apostrophe.
2022-01-20mg: fix -Wunused-but-set-variable warningsChristian Weisgerber
strtonum() is only called to verify that a string is numerical, the return value is unused. inlist is no longer used after the code was refactored. ok millert@ guenther@
2021-05-12Count the number of arguments in each expression as we initially goMark Lumsden
through the expression. To be used in checking function parameter profiles later.
2021-05-08Perhaps the syntax '((' and '()' will be valid one day, but not at theMark Lumsden
moment. This diff works the two checks for them into the main for parsing loop.
2021-05-08stop parsing if a digit is found as first character of an expression.Mark Lumsden
2021-05-07Give an error if quoted string is found as first non-white char afterMark Lumsden
'('.
2021-05-07Take a note of expression length when it is extracted from lineMark Lumsden
submitted to excline().
2021-05-06Add the line number of an error to error messages.Mark Lumsden
2021-05-06Add a number to parameters for ewprintf() via beeping.Mark Lumsden
2021-05-06Give parse error if character found between blocks.Mark Lumsden
2021-05-05Check the characters preceeding and following quotes.Mark Lumsden