summaryrefslogtreecommitdiff
path: root/usr.bin/mg/buffer.c
AgeCommit message (Collapse)Author
2017-08-06Present the default choice before the colon in prompts. Matches GNU EmacsBrian Callahan
behavior. From Scott Cheloha <scottcheloha@gmail.com> ok florian@
2017-03-13When aborting switch-to-buffer keep current buffer instead ofFlorian Obser
switching to *scratch*. (Which seems to be the least useful thing to do.) This brings mg in line with emacs. OK lum; deraadt@ was bugged by this, too
2016-09-07Source Joachim Nilsson:Mark Lumsden
Found by Coverity Scan. The popbuf() function iterated over a list to find a wp pointer, then sent it to showbuffer() which immediately went ahead and dereferenced it. This patch simply adds a NULL pointer check before calling showbuffer(), if NULL then just return NULL to callee. ok awolk@ millert@
2016-08-31Fix a bug reported by Han Boetes. Easily reproducible via:Mark Lumsden
mg c-x b RET c-x k RET mg segvs. Initial diff from Joachim Nilsson. This diff tested by Han and Joachim and ok florian@ jasper@
2015-10-10Call onlywind() properly.Mark Lumsden
2015-09-26whitespaceJasper Lievisse Adriaanse
2015-03-23DIFFTOOL has to be defined for mg to build. TCSASOFT is defined viaBrian Callahan
termios.h so we don't need the code for when it is not defined. ok reyk@
2015-03-19More unifdef cleanup:Brian Callahan
-UDIRED_XMAPS and -UFUND_XMAPS: you can't build mg the other way. -DTIOCGWINSZ: you have this if you have term.h Remove a #define TERMCAP which isn't being used. Remove defines for NDIRED_XMAPS, NFUND_XMAPS, and IMAPEXT. They are all defined to be 0 and are only ever used in addition. We don't need to add 0. Simply lines that were using those defines. ok florian@
2015-03-19Clean up the includes in mg.Brian Callahan
This does the following: Moves all POSIX headers from sysdef.h into the individual .c files so that each file now only includes what it needs. All headers are properly sorted. Moves the remainder of sysdef.h to other files (mostly def.h) and deletes sysdef.h now that it's no longer contains anything. Tweak a comment that references sysdef.h so that it no longer does that. ok florian@
2015-03-16Change the internal name of the newline function to deconflict with aBrian Callahan
function of the same name in term.h. This is the first step towards cleaning up mg's includes. No user-visible changes. ok florian@
2014-06-12Remove a comparison that is always true. Reported by clang.Brian Callahan
Merge the new if into a single line, requested by florian@ ok matthew@ florian@
2014-03-20Add some missing dobeeps.Mark Lumsden
ok florian@
2013-12-23Move findbuffer() to buffer.c.Mark Lumsden
ok florian@
2013-06-02Add the 'quit-window' dired command and receive a basic English lessonlum
from jmc@ again.
2013-02-17Replace hand rolled TAILQ_REMOVE with example from queue(3).Florian Obser
While this did work in this particular case because the list was no longer used it at least sets a bad example. ok benno, jasper, lum
2013-02-15cleanup undo history in revert-bufferFlorian Obser
problem spotted, initial diff and ok lum@
2012-12-27diff-buffer-with-fileFlorian Obser
input gsoares@, Sunil Nimmagadda, jasper@ ok jasper@, benno@
2012-11-06Remove never read struct member, found while investigating a llvmFlorian Obser
report. ok lum, jasper, benno
2012-11-03This should be void.Christiano F. Haesbaert
2012-10-23Use correct file for revert-buffer; do not ignore abort.Florian Obser
ok lum, jasper, benno
2012-10-22Add (r)evert prompt to "File changed on disk; really edit the buffer"Florian Obser
prompt. input, ok lum@, man bit ok jmc@, ok benno@
2012-10-22Check for dirty buffer on buffer change.Florian Obser
ok jasper@, benno@
2012-10-12- implement "revert-buffer", which reverts the current buffer to what's on diskJasper Lievisse Adriaanse
- split gotoline() into the argument handling part and the part that actually goes to the specified line number so it can be re-used by revertbuffer() input/ok florian@ haesbaert@
2012-08-31Allow an error message for a filename that is too long to be seen andlum
let the error stop mg exiting when C-x C-c is called.
2012-08-30Some line counter goodness from Florian Obser.lum
If you open an already open buffer via C-x C-f, odd things can happen with the cursor and line counter for that buffer. This diff stops that behaviour and no regressions viewable.
2012-08-30This diff allows the user to decide what to do with buffers thatlum
experience write errors during C-x C-c (exiting mg). Emacs stops the exiting process when it encounters problem buffers and lets the user decide what to do, currently mg continues exiting and the contents of these buffers are lost. This diff bring mg more into line with emacs. Review and observations from Sunil Nimmagadda.
2012-03-14Remove the NO_HELP conditional directives. If defined, mg will not compile andlum
has not done so for numerous years. Not hard to fix, but just remove anyway. ok kjell@ millert@
2011-01-23Wrap basename,dirname with xbasename, xdirname funtions,Kjell Wooding
which have fewer special cases, and use the strlcpy/strlcat src/dst/buffer len semantic. More portable to boot. Discussion and feedback from Henri Kemppainen
2011-01-21It volates style(9), but in mg, #include"def.h" goes first. 'twas the way it ↵Kjell Wooding
was built. no binary change here. confirmed by lum@, tested by Henri Kemppainen
2011-01-18Add missing prototypes and move dired.c to "extensions" in Makefile.lum
ok kjell@
2010-06-30you keep saying LIST_END. I do not think it means what you think itOwain Ainsworth
means. If we hit an OOM condition, mg started to try and dump the older undo buffer entries in order to be able to continue. OTOH, it was grabbing this entry with LIST_END, which like all *_END() list macros evaluates to NULL. Do what we actually want and switch that list to a TAILQ and use TAILQ_LAST to grab the last entry. Wrote this a loooooong time ago after a mail from Matthew Dempsky on bugs@. ok kjell@, beck@ also looked at this months ago and thought it was alright.
2009-06-05swap function order to bring into scopeTheo de Raadt
2009-06-04If a buffer is created with a name that starts and ends with an askeriskKjell Wooding
(e.g. *scratch*, *Completions*, *grep*) it is considered throwaway; i.e. the user will NOT be prompted to save changes when the buffer is killed.
2009-06-04Add the notion of an "ephemeral" popup, so we can flag a windowKjell Wooding
for destruction at a later date. (in the process, add a window flag field) This fixes an issue noted by maja: namely, the *completion* window that pops up when you try to complete a filename on buffer load would destroy any second window that you happened to have open. ok maja@
2009-06-04Rename w_flag to w_rflag. This is not a general purposeKjell Wooding
flag: it is for redisplay options only. I need an additional all-purpose flag, so renaming removes the desire to wrongly overload the existing one. Turdshine. No functional chage.
2009-06-02Fix up some comments to match realityKjell Wooding
2008-09-15Enable dirty buffer detection in mg.Kjell Wooding
Emulate the emacs behavior: after suspend/resume, buffer switch, or at save time, warn (prompt) the user if the file has been modified on disk in the interim. This has already saved my butt numerous times. ok phessler
2007-05-28Add a global-wd-mode command, which toggles between the currentKjell Wooding
behavior (every buffer maintains its own cwd) and the old behavior of one global working directory. This makes it slightly easier to hack on things like kernel code, where compilation, etc, are initiated from a different directory than you are working in. While here, fix setting/handling of global wd.
2006-11-19spacingTheo de Raadt
2006-11-18Move buffer name allocation into bnew() where it belongsKjell Wooding
2006-11-18Fix line number bug (actually, dot-mark bug). to reproduce:Kjell Wooding
-split window into two -open a file, set the mark -switch windows, open same file, exchange point-and-mark from peter de wachter (Debian bug#391827)
2006-07-25Add bfirstlp(), blastlp() macros, returning the first and last linesKjell Wooding
of a buffer respectively. Removes an ugly construction than necessitated "go to first line"-type comments throughout the code. No binary change
2006-07-25Rename the header line of a buffer to b_headp, from the remarkablyKjell Wooding
unintuitive b_linep. No binary change.
2006-07-08Fix a trio of bugs in line numbering: adjusting linenos after undo,Kjell Wooding
cutting a block, and off-by-one linecount. Initial bug discovered by jason
2006-06-01Display line number in the mg statusbar. Yes, it seems like a fuglyKjell Wooding
way to do it, but all the clever and pretty ways utterly failed. Basic use seems fine. We'll turdshine the special cases later. If it bothers you, use M-x line-number-mode, or put same in your ~/.mg file to disable. ok cloder, jason
2006-06-01find-file-other-window and find-buffer-other-window should splitKjell Wooding
the window if you ask for whatever file you are currently visiting. pointed out, ok beck@
2006-05-28Make Window Flags more mnemonic (and less dumb); i.e.Kjell Wooding
WFHARD -> WFFULL (Redraw full window) WFFORCE -> WFFRAME (Reframe window). No binary change
2006-05-02Make buffers store their own working directory. This makes things likeKjell Wooding
grep, compile, lint work as expected (act on current buffer's cwd). Display this path when opening or replacing a file, rather than relying on the user to guess, or remember.
2006-04-06Fix a bug whereby a written buffer (^X^W) would not have the correctKjell Wooding
trailing buffer number appended (e.g. "file<2>") in case an existing buffer shared its basename().
2006-04-03lint love; ok kjellTheo de Raadt