OpenBSD CVS

CVS log for src/usr.bin/mg/undo.c


[BACK] Up to [local] / src / usr.bin / mg

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.59 / (download) - annotate - [select for diffs], Wed Mar 8 04:43:11 2023 UTC (14 months, 1 week ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, HEAD
Changes since 1.58: +1 -3 lines
Diff to previous 1.58 (colored)

Delete obsolete /* ARGSUSED */ lint comments.

ok miod@ millert@

Revision 1.58 / (download) - annotate - [select for diffs], Mon Sep 5 08:10:58 2016 UTC (7 years, 8 months ago) by lum
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.57: +4 -1 lines
Diff to previous 1.57 (colored)

Initialize stack variables to zero before memmove().

    Coverity Scan reported these two stack variables as uninitialized, in
    particular the .r_lineno struct member was uninitialized.  This patch
    clears the 'struct region' rather than setting .r_lineno because if
    any more struct members are added in the future the clear will cover
    them too.

Source Joachim Nilsson. ok tom@ millert@

Revision 1.57 / (download) - annotate - [select for diffs], Fri Dec 11 20:21:23 2015 UTC (8 years, 5 months ago) by mmcc
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.56: +3 -5 lines
Diff to previous 1.56 (colored)

Remove NULL-checks before free().

Revision 1.56 / (download) - annotate - [select for diffs], Thu Mar 19 21:22:15 2015 UTC (9 years, 2 months ago) by bcallah
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.55: +7 -1 lines
Diff to previous 1.55 (colored)

Clean up the includes in mg.
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@

Revision 1.55 / (download) - annotate - [select for diffs], Thu Mar 20 07:47:29 2014 UTC (10 years, 2 months ago) by lum
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7, OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.54: +5 -1 lines
Diff to previous 1.54 (colored)

Add some missing dobeeps.
ok florian@

Revision 1.54 / (download) - annotate - [select for diffs], Sat Jun 1 16:27:56 2013 UTC (10 years, 11 months ago) by lum
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.53: +3 -2 lines
Diff to previous 1.53 (colored)

If popbuf() fails, calling function should return FALSE.

Revision 1.53 / (download) - annotate - [select for diffs], Mon Mar 25 11:39:38 2013 UTC (11 years, 1 month ago) by florian
Branch: MAIN
Changes since 1.52: +7 -1 lines
Diff to previous 1.52 (colored)

Correct line numbers for undo-list.
OK jasper@

Revision 1.52 / (download) - annotate - [select for diffs], Mon Mar 25 11:38:22 2013 UTC (11 years, 1 month ago) by florian
Branch: MAIN
Changes since 1.51: +8 -2 lines
Diff to previous 1.51 (colored)

Record when the buffer was saved in the undo history. The buffer
will be marked unchanged at the correct point when stepping
through the undo history.
OK jasper@

Revision 1.51 / (download) - annotate - [select for diffs], Tue Nov 6 18:04:10 2012 UTC (11 years, 6 months ago) by florian
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.50: +3 -10 lines
Diff to previous 1.50 (colored)

Remove never read struct member, found while investigating a llvm
report.

ok lum, jasper, benno

Revision 1.50 / (download) - annotate - [select for diffs], Wed Jun 30 19:12:54 2010 UTC (13 years, 10 months ago) by oga
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.49: +21 -21 lines
Diff to previous 1.49 (colored)

you keep saying LIST_END. I do not think it means what you think it
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.

Revision 1.49 / (download) - annotate - [select for diffs], Fri Jun 5 18:02:06 2009 UTC (14 years, 11 months ago) by kjell
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7, OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.48: +14 -7 lines
Diff to previous 1.48 (colored)

emacs handles the undo of a region kill (C-w) differently than a line kill
(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

Revision 1.48 / (download) - annotate - [select for diffs], Thu Jun 4 23:39:37 2009 UTC (14 years, 11 months ago) by kjell
Branch: MAIN
Changes since 1.47: +2 -2 lines
Diff to previous 1.47 (colored)

Add the notion of an "ephemeral" popup, so we can flag a window
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@

Revision 1.47 / (download) - annotate - [select for diffs], Mon Sep 15 16:13:35 2008 UTC (15 years, 8 months ago) by kjell
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.46: +50 -29 lines
Diff to previous 1.46 (colored)

Expose the undo commands as proper mg functions.
This should have no functional change on undo, but it does facilitate
testing undo behavior.

Revision 1.46 / (download) - annotate - [select for diffs], Sat Jun 14 07:38:53 2008 UTC (15 years, 11 months ago) by kjell
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.45: +12 -4 lines
Diff to previous 1.45 (colored)

unf*ck undo.
No seriously. Reposition the cursor to the start of the redo
position, like emacs. This gets us halfway to being emacs-finger-friendly.
For the rest, introduce a rptcount variable to count successive invocations
of the same function. This means undo will abort properly on C-g, and
other such interruptions.
This is a lot of diff for a simple-seeming problem. Emacs undo is hard.

Revision 1.45 / (download) - annotate - [select for diffs], Wed Jun 11 17:07:37 2008 UTC (15 years, 11 months ago) by kjell
Branch: MAIN
Changes since 1.44: +2 -24 lines
Diff to previous 1.44 (colored)

With Vincent's permission, the last remaining chunk of mg has been
placed in the public domain.
This means mg (minus theo.c) is once again a public domain
piece of code. Please try to keep it that way.

Revision 1.44 / (download) - annotate - [select for diffs], Sun Sep 16 20:34:18 2007 UTC (16 years, 8 months ago) by kjell
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.43: +2 -2 lines
Diff to previous 1.43 (colored)

I can't think of any good reason to inline this.
Makes pcc happier, to boot.

Revision 1.43 / (download) - annotate - [select for diffs], Sun Nov 19 16:51:19 2006 UTC (17 years, 6 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_2_BASE, OPENBSD_4_2, OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.42: +2 -2 lines
Diff to previous 1.42 (colored)

spacing

Revision 1.42 / (download) - annotate - [select for diffs], Fri Nov 17 08:45:31 2006 UTC (17 years, 6 months ago) by kjell
Branch: MAIN
Changes since 1.41: +31 -30 lines
Diff to previous 1.41 (colored)

Fix a needless inversion of flag names; i.e. change them from the
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@

Revision 1.41 / (download) - annotate - [select for diffs], Tue Jul 25 08:22:32 2006 UTC (17 years, 9 months ago) by kjell
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.40: +6 -6 lines
Diff to previous 1.40 (colored)

Rename the header line of a buffer to b_headp, from the remarkably
unintuitive b_linep. No binary change.

Revision 1.40 / (download) - annotate - [select for diffs], Sat Jul 8 17:56:10 2006 UTC (17 years, 10 months ago) by kjell
Branch: MAIN
Changes since 1.39: +30 -8 lines
Diff to previous 1.39 (colored)

Introduce a 'MODIFIED' boundary type for undo records.
This allows undo to clear the modified flag when undo-ing all the way
from a loaded buffer.
Originally whipped up at c2k6 after proddings from beck.
jason@ ok.

Revision 1.39 / (download) - annotate - [select for diffs], Sat Jul 8 17:50:30 2006 UTC (17 years, 10 months ago) by kjell
Branch: MAIN
Changes since 1.38: +12 -4 lines
Diff to previous 1.38 (colored)

Fix a trio of bugs in line numbering: adjusting linenos after undo,
cutting a block, and off-by-one linecount. Initial bug discovered by
jason

Revision 1.38 / (download) - annotate - [select for diffs], Tue Dec 20 05:04:28 2005 UTC (18 years, 5 months ago) by kjell
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.37: +5 -5 lines
Diff to previous 1.37 (colored)

Do some delinting of strl-type functions. Also, remove a superfluous
word in the undo-list.

Revision 1.37 / (download) - annotate - [select for diffs], Tue Dec 13 07:20:13 2005 UTC (18 years, 5 months ago) by kjell
Branch: MAIN
Changes since 1.36: +5 -5 lines
Diff to previous 1.36 (colored)

Last round of easy delinting.

Revision 1.36 / (download) - annotate - [select for diffs], Tue Dec 13 05:40:33 2005 UTC (18 years, 5 months ago) by kjell
Branch: MAIN
Changes since 1.35: +2 -2 lines
Diff to previous 1.35 (colored)

do some silly de-linting

Revision 1.35 / (download) - annotate - [select for diffs], Fri Nov 18 20:56:53 2005 UTC (18 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.34: +17 -17 lines
Diff to previous 1.34 (colored)

greedy use of typedef struct was making code harder to read; ok kjell cloder

Revision 1.34 / (download) - annotate - [select for diffs], Fri Nov 18 17:11:21 2005 UTC (18 years, 6 months ago) by kjell
Branch: MAIN
Changes since 1.33: +2 -2 lines
Diff to previous 1.33 (colored)

One liner to fix doubled yank buffer issue (c-K, c-Y, M-x undo, c-Y).

Revision 1.33 / (download) - annotate - [select for diffs], Sat Nov 12 18:48:08 2005 UTC (18 years, 6 months ago) by kjell
Branch: MAIN
Changes since 1.32: +5 -2 lines
Diff to previous 1.32 (colored)

Paranoia. Check if last of a series of strlcats overflows. Pointed out by
Han Boetes.

Revision 1.32 / (download) - annotate - [select for diffs], Fri Oct 14 19:46:46 2005 UTC (18 years, 7 months ago) by kjell
Branch: MAIN
Changes since 1.31: +3 -1 lines
Diff to previous 1.31 (colored)

add missing /* ARGSUSED */ to quiet lint.

Revision 1.31 / (download) - annotate - [select for diffs], Thu Oct 13 20:28:49 2005 UTC (18 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.30: +3 -3 lines
Diff to previous 1.30 (colored)

spacing

Revision 1.30 / (download) - annotate - [select for diffs], Thu Oct 13 20:07:26 2005 UTC (18 years, 7 months ago) by kjell
Branch: MAIN
Changes since 1.29: +17 -3 lines
Diff to previous 1.29 (colored)

Make undoing of a yank operation work as expected
(i.e. undo boundaries are placed around entire yanked block)
ok cloder@

Revision 1.29 / (download) - annotate - [select for diffs], Tue Oct 11 01:08:53 2005 UTC (18 years, 7 months ago) by kjell
Branch: MAIN
Changes since 1.28: +14 -14 lines
Diff to previous 1.28 (colored)

A while back, undo records were moved from the BUFFER struct to MGWIN.
This is nonsensical, and utterly broken if you are undo-ing across
multiple buffers. Change them back to being associated with the BUFFER
struct. (effectively, just revert the original change)

ok deraadt@

Revision 1.28 / (download) - annotate - [select for diffs], Thu Oct 6 16:48:00 2005 UTC (18 years, 7 months ago) by kjell
Branch: MAIN
Changes since 1.27: +21 -7 lines
Diff to previous 1.27 (colored)

Make mg undo much more emacs like (and correct).
Undo boundaries are now placed at newlines, and undo
of search-replace works as expected. Fixes bad behaviour
reported by matthieu

Ok deraadt@, beck@

Revision 1.27 / (download) - annotate - [select for diffs], Sun May 29 21:37:49 2005 UTC (18 years, 11 months ago) by cloder
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.26: +2 -3 lines
Diff to previous 1.26 (colored)

Try to undo crazy Quebecois stuff that was breaking undo

Revision 1.26 / (download) - annotate - [select for diffs], Fri Apr 29 07:22:38 2005 UTC (19 years ago) by otto
Branch: MAIN
Changes since 1.25: +1 -3 lines
Diff to previous 1.25 (colored)

Remove unneeded include. Han Boetes.

Revision 1.25 / (download) - annotate - [select for diffs], Sun Apr 3 02:09:28 2005 UTC (19 years, 1 month ago) by db
Branch: MAIN
Changes since 1.24: +34 -35 lines
Diff to previous 1.24 (colored)

This is a no binary change which does:

- spelling, punctuation fixes
- variable declaration lineup
- use parentheses for return and sizeof
- K&R function declarations -> ANSI
- other minor code beautification

ok henning@

Revision 1.24 / (download) - annotate - [select for diffs], Mon Dec 15 00:00:12 2003 UTC (20 years, 5 months ago) by vincent
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7, OPENBSD_3_6_BASE, OPENBSD_3_6, OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.23: +12 -12 lines
Diff to previous 1.23 (colored)

shorter function names

Revision 1.23 / (download) - annotate - [select for diffs], Sat Nov 29 17:28:40 2003 UTC (20 years, 5 months ago) by vincent
Branch: MAIN
Changes since 1.22: +12 -15 lines
Diff to previous 1.22 (colored)

save the previous undo position as an offset in the buffer instead of
a line/offset pair

Revision 1.22 / (download) - annotate - [select for diffs], Sun Nov 9 01:44:39 2003 UTC (20 years, 6 months ago) by vincent
Branch: MAIN
Changes since 1.21: +21 -18 lines
Diff to previous 1.21 (colored)

better boundary placement.

there should be no more problems with inserting files now...

Revision 1.21 / (download) - annotate - [select for diffs], Sun Nov 9 01:20:32 2003 UTC (20 years, 6 months ago) by vincent
Branch: MAIN
Changes since 1.20: +5 -5 lines
Diff to previous 1.20 (colored)

fix a bug i introduced in -r1.19, we should still use the current buffer
to test for the end of circular lists.

Revision 1.20 / (download) - annotate - [select for diffs], Sun Nov 9 01:11:14 2003 UTC (20 years, 6 months ago) by vincent
Branch: MAIN
Changes since 1.19: +1 -34 lines
Diff to previous 1.19 (colored)

remove the only use of the hackish undo_add_custom function.

Revision 1.19 / (download) - annotate - [select for diffs], Tue Oct 21 22:48:07 2003 UTC (20 years, 7 months ago) by vincent
Branch: MAIN
Changes since 1.18: +17 -17 lines
Diff to previous 1.18 (colored)

make undo records per MGWIN, not per BUFFER...

Revision 1.18 / (download) - annotate - [select for diffs], Thu Jun 26 23:04:10 2003 UTC (20 years, 10 months ago) by vincent
Branch: MAIN
CVS Tags: OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.17: +2 -2 lines
Diff to previous 1.17 (colored)

protos

ok deraadt

Revision 1.17 / (download) - annotate - [select for diffs], Sun Jun 1 15:53:34 2003 UTC (20 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.16: +2 -2 lines
Diff to previous 1.16 (colored)

various format string cleanups; tedu ok

Revision 1.16 / (download) - annotate - [select for diffs], Tue May 20 03:08:55 2003 UTC (21 years ago) by cloder
Branch: MAIN
Changes since 1.15: +2 -2 lines
Diff to previous 1.15 (colored)

Finish KNF of prototypes.  That should be all of them.
OK vincent@

Revision 1.15 / (download) - annotate - [select for diffs], Sun Apr 13 19:16:49 2003 UTC (21 years, 1 month ago) by avsm
Branch: MAIN
Changes since 1.14: +2 -2 lines
Diff to previous 1.14 (colored)

correct snprintf bound value, ok millert@, deraadt@

Revision 1.14 / (download) - annotate - [select for diffs], Sun Sep 15 22:18:39 2002 UTC (21 years, 8 months ago) by vincent
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3, OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.13: +4 -4 lines
Diff to previous 1.13 (colored)

don't add undo records when we open a file, only when we insert it.

ok deraadt@

Revision 1.13 / (download) - annotate - [select for diffs], Thu Aug 22 23:28:19 2002 UTC (21 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.12: +10 -10 lines
Diff to previous 1.12 (colored)

knf

Revision 1.12 / (download) - annotate - [select for diffs], Wed Jul 24 14:08:33 2002 UTC (21 years, 10 months ago) by vincent
Branch: MAIN
Changes since 1.11: +11 -36 lines
Diff to previous 1.11 (colored)

 remove the CHANGE undo record type, use a combination of delete and insert
to have the same behavior in a simpler way.

 ok art@

Revision 1.11 / (download) - annotate - [select for diffs], Thu Jun 20 04:27:11 2002 UTC (21 years, 11 months ago) by vincent
Branch: MAIN
Changes since 1.10: +26 -26 lines
Diff to previous 1.10 (colored)

KNFify the return (return x -> return (x))
remove an "else" from last commit, it didn't make a lot of sense.

Revision 1.10 / (download) - annotate - [select for diffs], Thu Jun 20 03:59:15 2002 UTC (21 years, 11 months ago) by vincent
Branch: MAIN
Changes since 1.9: +21 -22 lines
Diff to previous 1.9 (colored)

 some KNF

Revision 1.9 / (download) - annotate - [select for diffs], Mon Mar 18 01:45:55 2002 UTC (22 years, 2 months ago) by vincent
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.8: +241 -162 lines
Diff to previous 1.8 (colored)

 Enter the new undo code.  it is still disabled since it has bugs, but it's
somewhat more useful....

 ok millert@ + no objections on ICB

Revision 1.8 / (download) - annotate - [select for diffs], Sat Mar 16 20:29:21 2002 UTC (22 years, 2 months ago) by vincent
Branch: MAIN
Changes since 1.7: +55 -1 lines
Diff to previous 1.7 (colored)

 This should've been commited yesterday, before the funmap change.

 ok millert@

Revision 1.7 / (download) - annotate - [select for diffs], Tue Feb 26 00:45:45 2002 UTC (22 years, 2 months ago) by vincent
Branch: MAIN
Changes since 1.6: +12 -32 lines
Diff to previous 1.6 (colored)

keep undo records in the BUFFER structures insteda of having a huge list.

Revision 1.6 / (download) - annotate - [select for diffs], Thu Feb 21 17:36:12 2002 UTC (22 years, 3 months ago) by vincent
Branch: MAIN
Changes since 1.5: +5 -3 lines
Diff to previous 1.5 (colored)

 "rephrase" the loop's condition, gets rid of an ugly operation.

Revision 1.5 / (download) - annotate - [select for diffs], Thu Feb 21 04:21:05 2002 UTC (22 years, 3 months ago) by vincent
Branch: MAIN
Changes since 1.4: +22 -1 lines
Diff to previous 1.4 (colored)

 Save undo records for newline insertions.

 That makes mg behave more like GNU emacs.

Revision 1.4 / (download) - annotate - [select for diffs], Thu Feb 21 04:16:27 2002 UTC (22 years, 3 months ago) by vincent
Branch: MAIN
Changes since 1.3: +45 -42 lines
Diff to previous 1.3 (colored)


 Don't ignore the argument to undo. (makes ^U work)

Revision 1.3 / (download) - annotate - [select for diffs], Thu Feb 21 03:24:14 2002 UTC (22 years, 3 months ago) by vincent
Branch: MAIN
Changes since 1.2: +5 -4 lines
Diff to previous 1.2 (colored)

 Typo and...

 Duh, newlines aren't even stored in the lines' content, check for
 a 0 length line to detect deleting newlines.

Revision 1.2 / (download) - annotate - [select for diffs], Wed Feb 20 23:15:03 2002 UTC (22 years, 3 months ago) by vincent
Branch: MAIN
Changes since 1.1: +8 -4 lines
Diff to previous 1.1 (colored)

 Save newline deletes in their own undo record.

 fixes the ^K^K bugs.

Revision 1.1 / (download) - annotate - [select for diffs], Wed Feb 20 22:30:54 2002 UTC (22 years, 3 months ago) by vincent
Branch: MAIN

 Add undo code to mg.

 needs further hacking.

 ok `whole bunch of people on icb'@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.