summaryrefslogtreecommitdiff
path: root/usr.bin/mg/line.c
AgeCommit message (Collapse)Author
2015-09-29Mark eread(), veread(), and eformat() as printf-like andPhilip Guenther
Convert eread(buf, a2, a3, a4) to eread("%s", a2, a3, a4, buf) ok millert@ lum@
2015-06-03Remove unused defines and functions.Brian Callahan
"Looks fine." deraadt@
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@
2014-11-16Stop using <sys/param.h>; replace MAXPATHLEN with PATH_MAX, stop using MAX(),Philip Guenther
and pull in <limits.h> for *_MAX constants. inspired on a diff from Kamil Rytarowski (n54 (at) gmx.com) ok bcallah@
2014-03-20Add some missing dobeeps.Mark Lumsden
ok florian@
2013-12-23Fix two dotline bugs for the price of one.Florian Obser
1) When answering "No newline at end of file, add one?" with y and dot is not at the end of buffer dotline is off by one 2) When displaying the same buffer in two windows, dot in the second window is below dot in the first and a newline is entered in the first window dotline is not updated in the second. OK lum
2013-06-01The k*() functions were moved to yank.c in 2005. Update the comment tolum
reflect this.
2011-01-18Obvious error on my part.Kjell Wooding
test len against INT_MAX, not SIZE_MAX. 'looks good' jasper@
2009-11-12fix memory leak found by parfait; ok jsg@Todd C. Miller
2009-06-05emacs handles the undo of a region kill (C-w) differently than a line killKjell Wooding
(C-k) with respect to cursor position. The former leaves the cursor at the end, the latter at the beginning of the region. emacs is wacky. Make mg undo do the same. ok deraadt
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.
2008-09-15Expose the undo commands as proper mg functions.Kjell Wooding
This should have no functional change on undo, but it does facilitate testing undo behavior.
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
2006-12-24Fix a bug where inserting a file resulted in an incorrectKjell Wooding
line-number count for a buffer (M-X insert-file, M-> to reproduce). While here, fix a number of bugs with incorrect line numbers after swap point-and-mark Originally reported via debian's bug tracking system. Fix tested by Han Boetes and Deanna Phillips.
2006-11-17Fix a needless inversion of flag names; i.e. change them from theKjell Wooding
negative to the positive. undo_boundary_enable(TRUE) makes a LOT more sense than undo_no_boundary(FALSE). While here, whack a global, and fix a bug noted by otto: undoing a file insertion sometimes left stray characters around. ok beck@, otto@
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-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-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-27Move mg "line to c-string" functionality to a function.Kjell Wooding
2005-12-20Clean up the ugly casted frees. In one case, this meant eliminating a nastyKjell Wooding
struct/union/casting nightmare when building the list of names for filename completion. In particular, be consistent about strduping and freeing the list data.
2005-12-20Do some delinting of strl-type functions. Also, remove a superfluousKjell Wooding
word in the undo-list.
2005-12-20Fix broken "Undo of undo" when line is empty. Noticed by theo.Kjell Wooding
2005-12-13do some silly de-lintingKjell Wooding
2005-11-22Move kill-related commands to their own file.Kjell Wooding
This will help move to a kill-ring.
2005-11-22Fix backwards insert into kill buffer (aaa \n bbb M-BS M-BS c-Y) byKjell Wooding
batching string before prepending. ok cloder, (grudgingly) beck
2005-11-21kill kill kill unused stuff; ok kjellTheo de Raadt
2005-11-20toast NO_DIRED #ifdef; ok kjellTheo de Raadt
2005-11-18Split kill buffer code into a separate function.Kjell Wooding
2005-11-18greedy use of typedef struct was making code harder to read; ok kjell cloderTheo de Raadt
2005-11-18Casefold on replace was killed ages ago (it was wrong). Remove aKjell Wooding
leftover (unused) variable.
2005-11-18Kill a stupid interface. kgrow should take direction, not TRUE/FALSE.Kjell Wooding
2005-10-13spacingTheo de Raadt
2005-10-06Make mg undo much more emacs like (and correct).Kjell Wooding
Undo boundaries are now placed at newlines, and undo of search-replace works as expected. Fixes bad behaviour reported by matthieu Ok deraadt@, beck@
2005-06-14Add explicit public domain notices to all public domain files.Kjell Wooding
ok millert@, deraadt@
2005-04-03This is a no binary change which does:David Berghoff
- spelling, punctuation fixes - variable declaration lineup - use parentheses for return and sizeof - K&R function declarations -> ANSI - other minor code beautification ok henning@
2004-07-09when saving a file, check whether it is newline terminated and if it is not,Vincent Labrecque
prompt the user and add the newline if he agrees. tested by a lot of helpful tech@ guys, approved by henning
2004-01-27make mail-mode more intelligent on middle-of-line insertions, and add aVincent Labrecque
comment to change the wrapping column. (mail-set-margin) tested by henning and phessler, thanks!
2003-11-09remove the only use of the hackish undo_add_custom function.Vincent Labrecque
2003-04-16lalloc() - return NULL on error, not FALSETodd C. Miller
lrealloc() - don't realloc if new size <= old size. Avoids a realloc(p, 0) vincent@ OK
2002-07-01KNF + ansi; from zyrnix (only the easy part of his diffs)Vincent Labrecque
2002-03-18 Enter the new undo code. it is still disabled since it has bugs, but it'sVincent Labrecque
somewhat more useful.... ok millert@ + no objections on ICB
2002-03-16 add readonly buffer supportVincent Labrecque
plus some KNF ok art@
2002-02-21 Save undo records for newline insertions.Vincent Labrecque
That makes mg behave more like GNU emacs.
2002-02-20 Add undo code to mg.Vincent Labrecque
needs further hacking. ok `whole bunch of people on icb'@
2002-02-16Part one of userland __P removal. Done with a simple regexp with some minor ↵Todd C. Miller
hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.
2002-02-14some KNFTheo de Raadt
2002-02-14 Oups, my chartypes commit broke this.Vincent Labrecque
Use mg specific _MG_U/_MG_L chartypes instead of systemwide ones.
2002-02-13 Make mg malloc the l_text element instead of reallocating whole LINEVincent Labrecque
structures all the time.
2001-05-24spacesMichael Shalayeff