OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.50 / (download) - annotate - [select for diffs], Fri Apr 28 10:02:03 2023 UTC (12 months, 3 weeks ago) by op
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, HEAD
Changes since 1.49: +4 -4 lines
Diff to previous 1.49 (colored)

fix lfindent (newline-and-indent) comment and description in the man page

for a while it has used only spaces when no-tab-mode is enabled and respected
the current buffer tab width.

Revision 1.49 / (download) - annotate - [select for diffs], Fri Apr 21 14:14:13 2023 UTC (12 months, 4 weeks ago) by op
Branch: MAIN
Changes since 1.48: +5 -5 lines
Diff to previous 1.48 (colored)

mg: fix space_to_tabstop

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@

Revision 1.48 / (download) - annotate - [select for diffs], Fri Apr 21 13:39:37 2023 UTC (12 months, 4 weeks ago) by op
Branch: MAIN
Changes since 1.47: +22 -6 lines
Diff to previous 1.47 (colored)

mg: allow to change the tab width

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@

Revision 1.47 / (download) - annotate - [select for diffs], Mon Apr 17 09:53:08 2023 UTC (13 months ago) by op
Branch: MAIN
Changes since 1.46: +3 -1 lines
Diff to previous 1.46 (colored)

add doindent() prototype at the start of the file; forgotten in previous

Revision 1.46 / (download) - annotate - [select for diffs], Mon Apr 17 09:49:04 2023 UTC (13 months ago) by op
Branch: MAIN
Changes since 1.45: +22 -21 lines
Diff to previous 1.45 (colored)

resurrect mg' no-tab-mode

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@

Revision 1.45 / (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_3_BASE, OPENBSD_7_3
Changes since 1.44: +1 -11 lines
Diff to previous 1.44 (colored)

Delete obsolete /* ARGSUSED */ lint comments.

ok miod@ millert@

Revision 1.44 / (download) - annotate - [select for diffs], Tue May 24 16:24:31 2022 UTC (23 months, 3 weeks ago) by op
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.43: +2 -1 lines
Diff to previous 1.43 (colored)

automatically delete trailing whitespaces on RET in c-mode and
auto-indent-mode (only after computing the auto indent.)

tested also by Mikhail (thanks!).  ok tb@

Revision 1.43 / (download) - annotate - [select for diffs], Mon Mar 1 10:51:14 2021 UTC (3 years, 2 months ago) by lum
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.42: +4 -3 lines
Diff to previous 1.42 (colored)

Put the hardcoded '\n' character which is found throughout mg into a
buffer specific variable. The diff should not produce any behavourial
changes in mg.

Revision 1.42 / (download) - annotate - [select for diffs], Sat Jun 22 15:38:15 2019 UTC (4 years, 10 months ago) by lum
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.41: +5 -5 lines
Diff to previous 1.41 (colored)

Tidy up the comments:
1. two spelling mistakes.
2. change references to keystrokes, same as man page (UP-low).
3. update a filename reference to reality.

Revision 1.41 / (download) - annotate - [select for diffs], Fri Jun 7 07:54:05 2019 UTC (4 years, 11 months ago) by lum
Branch: MAIN
Changes since 1.40: +26 -11 lines
Diff to previous 1.40 (colored)

Amend showcpos() to show more information about how mg is operating.
The additions help while developing mg by not having to go into gdb to
see somethings mg believes about itself. The extra data shown could be
removed in future, but it is benign so perhaps it could stay.

Also, do not fake a '\n' on the end of buffer. It is confusing.
However do not change the lie about '\n' being on the end of every
line within the buffer. Hopefully, one day, that will no longer be a
lie.

Revision 1.40 / (download) - annotate - [select for diffs], Wed Dec 26 07:01:22 2018 UTC (5 years, 4 months ago) by phessler
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.39: +1 -9 lines
Diff to previous 1.39 (colored)

revert "kill a region if 'delete' or 'backspace' is pressed"
This caused a change of behaviour in the search case, and isn't yet ready.

Committing on the behalf of lum@

OK lum@

Revision 1.39 / (download) - annotate - [select for diffs], Tue Dec 18 20:35:34 2018 UTC (5 years, 5 months ago) by lum
Branch: MAIN
Changes since 1.38: +10 -2 lines
Diff to previous 1.38 (colored)

Make mg kill a region if the 'delete' or 'backspace' keys are pressed
and a region is selected.  The contents of the region are then placed
into the kill buffer. Like emacs.

Revision 1.38 / (download) - annotate - [select for diffs], Wed Nov 18 18:21:06 2015 UTC (8 years, 6 months ago) by jasper
Branch: MAIN
CVS Tags: 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, OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.37: +2 -2 lines
Diff to previous 1.37 (colored)

whitespace

Revision 1.37 / (download) - annotate - [select for diffs], Sat Oct 10 09:13:14 2015 UTC (8 years, 7 months ago) by lum
Branch: MAIN
Changes since 1.36: +4 -1 lines
Diff to previous 1.36 (colored)

Make functions that accept multiple iterations via C-u N, honour 0.
Except C-k which has a defined behaviour. In mg, C-t doesn't complete
n iterations if requested, but probably should, hence it has been
included in this diff.

Revision 1.36 / (download) - annotate - [select for diffs], Tue Sep 29 03:19:24 2015 UTC (8 years, 7 months ago) by guenther
Branch: MAIN
Changes since 1.35: +1 -2 lines
Diff to previous 1.35 (colored)

Delete the final, inscrutable NOSTRICT and VARARGS lint comments

ok millert@

Revision 1.35 / (download) - annotate - [select for diffs], Thu Mar 19 21:22:15 2015 UTC (9 years, 2 months ago) by bcallah
Branch: MAIN
Changes since 1.34: +6 -3 lines
Diff to previous 1.34 (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.34 / (download) - annotate - [select for diffs], Mon Mar 16 13:47:48 2015 UTC (9 years, 2 months ago) by bcallah
Branch: MAIN
Changes since 1.33: +2 -2 lines
Diff to previous 1.33 (colored)

Change the internal name of the newline function to deconflict with a
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@

Revision 1.33 / (download) - annotate - [select for diffs], Wed Mar 26 22:02:06 2014 UTC (10 years, 1 month ago) by lum
Branch: MAIN
Changes since 1.32: +33 -21 lines
Diff to previous 1.32 (colored)

Previously, C-t (transpose two chars) did not behave the same as
Emacs.  This diff makes mg behave more so. Though new-line characters
are treated as any other.

Difference from emacs observed and reported by deraadt@. First diff
tested and ridiculed by deraadt@. Second diff not tested and not
ridiculed by deraadt@ but at least email responded to.

Revision 1.32 / (download) - annotate - [select for diffs], Mon Mar 25 11:41:44 2013 UTC (11 years, 1 month ago) by florian
Branch: MAIN
Changes since 1.31: +6 -6 lines
Diff to previous 1.31 (colored)

Display the window's column number in mode line not the
column number of the active window.
OK jasper@

Revision 1.31 / (download) - annotate - [select for diffs], Fri May 18 02:13:44 2012 UTC (12 years ago) by lum
Branch: MAIN
Changes since 1.30: +2 -2 lines
Diff to previous 1.30 (colored)

Allow no-tab-mode to compile. From James Turner.

note: no-tab-mode needs more work done before removing the NOTABs.

Revision 1.30 / (download) - annotate - [select for diffs], Fri Jan 21 19:10:13 2011 UTC (13 years, 4 months ago) by kjell
Branch: MAIN
Changes since 1.29: +2 -1 lines
Diff to previous 1.29 (colored)

It volates style(9), but in mg, #include"def.h" goes first. 'twas the way it was built. no binary change here. confirmed by lum@, tested by Henri Kemppainen

Revision 1.29 / (download) - annotate - [select for diffs], Wed Jan 19 16:11:38 2011 UTC (13 years, 4 months ago) by kjell
Branch: MAIN
Changes since 1.28: +16 -6 lines
Diff to previous 1.28 (colored)

patch from Henri Kemppainen:
clean up undo boundaries for functions in random.c
This catches an error, where twiddling in an empty file could
disable undo boundaries for the rest of the session.
proper undo boundaries around newline() will have to wait until
proper reference counting is done... Thanks!

Revision 1.28 / (download) - annotate - [select for diffs], Tue Jan 18 16:25:40 2011 UTC (13 years, 4 months ago) by kjell
Branch: MAIN
Changes since 1.27: +31 -1 lines
Diff to previous 1.27 (colored)

Add join-line, bound to M-^
Join the current line to the previous.

original diff by Henri Kemppainen. minor mod to add undo boundaries.
Thanks!

Revision 1.27 / (download) - annotate - [select for diffs], Mon Jan 17 03:12:06 2011 UTC (13 years, 4 months ago) by kjell
Branch: MAIN
Changes since 1.26: +14 -1 lines
Diff to previous 1.26 (colored)

Add back-to-indentation. (M-m)
Move the dot to the first non-whitespace character on the current line.
from Henri Kemppainen . ok theo

Revision 1.26 / (download) - annotate - [select for diffs], Mon Sep 15 16:13:35 2008 UTC (15 years, 8 months ago) by kjell
Branch: MAIN
Changes since 1.25: +3 -5 lines
Diff to previous 1.25 (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.25 / (download) - annotate - [select for diffs], Wed Jun 11 23:18:33 2008 UTC (15 years, 11 months ago) by kjell
Branch: MAIN
Changes since 1.24: +90 -5 lines
Diff to previous 1.24 (colored)

Add delete-leading-space, delete-trailing-space,
indent-current-line utility functions for stripping leading/trailing
whitespace, and setting a fixed indent respectively.

Revision 1.24 / (download) - annotate - [select for diffs], Thu Feb 8 21:40:38 2007 UTC (17 years, 3 months ago) by kjell
Branch: MAIN
Changes since 1.23: +2 -2 lines
Diff to previous 1.23 (colored)

Fix a comment

Revision 1.23 / (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.22: +3 -3 lines
Diff to previous 1.22 (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.22 / (download) - annotate - [select for diffs], Tue Jul 25 08:27:09 2006 UTC (17 years, 9 months ago) by kjell
Branch: MAIN
Changes since 1.21: +2 -2 lines
Diff to previous 1.21 (colored)

Add bfirstlp(), blastlp() macros, returning the first and last lines
of a buffer respectively. Removes an ugly construction than necessitated
"go to first line"-type comments throughout the code.
No binary change

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

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

Revision 1.20 / (download) - annotate - [select for diffs], Thu Jun 1 10:10:00 2006 UTC (17 years, 11 months ago) by kjell
Branch: MAIN
Changes since 1.19: +5 -6 lines
Diff to previous 1.19 (colored)

kill another superfluous strlen

Revision 1.19 / (download) - annotate - [select for diffs], Thu Jun 1 09:54:08 2006 UTC (17 years, 11 months ago) by kjell
Branch: MAIN
Changes since 1.18: +5 -5 lines
Diff to previous 1.18 (colored)

Style. no practical change.

Revision 1.18 / (download) - annotate - [select for diffs], Thu Jun 1 04:17:34 2006 UTC (17 years, 11 months ago) by kjell
Branch: MAIN
Changes since 1.17: +14 -5 lines
Diff to previous 1.17 (colored)

Make transpose (c-T) undoable.
There is still a bug here, but it lies in undo (cursor position when undo
wraps the undo list), and is purely cosmetic for now.

Revision 1.17 / (download) - annotate - [select for diffs], Tue Nov 22 05:02:44 2005 UTC (18 years, 6 months ago) by kjell
Branch: MAIN
Changes since 1.16: +1 -120 lines
Diff to previous 1.16 (colored)

Move kill-related commands to their own file.
This will help move to a kill-ring.

Revision 1.16 / (download) - annotate - [select for diffs], Sat Nov 19 20:16:35 2005 UTC (18 years, 6 months ago) by kjell
Branch: MAIN
Changes since 1.15: +1 -3 lines
Diff to previous 1.15 (colored)

Clean up some lint.

Revision 1.15 / (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.14: +7 -7 lines
Diff to previous 1.14 (colored)

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

Revision 1.14 / (download) - annotate - [select for diffs], Fri Nov 18 19:04:09 2005 UTC (18 years, 6 months ago) by kjell
Branch: MAIN
Changes since 1.13: +2 -15 lines
Diff to previous 1.13 (colored)

Don't ifdef out. Delete it. That's what the attic is for.

Revision 1.13 / (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.12: +5 -1 lines
Diff to previous 1.12 (colored)

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

Revision 1.12 / (download) - annotate - [select for diffs], Tue Jun 14 18:14:40 2005 UTC (18 years, 11 months ago) by kjell
Branch: MAIN
Changes since 1.11: +3 -1 lines
Diff to previous 1.11 (colored)

Add explicit public domain notices to all public domain files.
ok millert@, deraadt@

Revision 1.11 / (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.10: +36 -40 lines
Diff to previous 1.10 (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.10 / (download) - annotate - [select for diffs], Tue May 20 03:08:55 2003 UTC (21 years ago) by cloder
Branch: MAIN
Changes since 1.9: +14 -27 lines
Diff to previous 1.9 (colored)

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

Revision 1.9 / (download) - annotate - [select for diffs], Fri May 16 19:28:59 2003 UTC (21 years ago) by vincent
Branch: MAIN
Changes since 1.8: +14 -6 lines
Diff to previous 1.8 (colored)

fix the goal calculation routine so moving up and down moves to the right
column.

ok jason

Revision 1.8 / (download) - annotate - [select for diffs], Thu May 30 16:07:57 2002 UTC (21 years, 11 months ago) by vincent
Branch: MAIN
Changes since 1.7: +3 -3 lines
Diff to previous 1.7 (colored)

fix segfault when using just-one-space on an empty line; from
dkm_holdings@hotmail.com

ok art@

Revision 1.7 / (download) - annotate - [select for diffs], Thu Feb 14 14:24:21 2002 UTC (22 years, 3 months ago) by deraadt
Branch: MAIN
Changes since 1.6: +6 -6 lines
Diff to previous 1.6 (colored)

some KNF

Revision 1.6 / (download) - annotate - [select for diffs], Thu May 24 03:05:25 2001 UTC (23 years ago) by mickey
Branch: MAIN
Changes since 1.5: +44 -44 lines
Diff to previous 1.5 (colored)

spaces

Revision 1.5 / (download) - annotate - [select for diffs], Wed May 23 22:20:36 2001 UTC (23 years ago) by art
Branch: MAIN
Changes since 1.4: +4 -4 lines
Diff to previous 1.4 (colored)

remove VOID. We're way beyond the point where this could build with an
ancient compiler.

Revision 1.4 / (download) - annotate - [select for diffs], Mon Jan 29 01:58:09 2001 UTC (23 years, 3 months ago) by niklas
Branch: MAIN
Changes since 1.3: +2 -0 lines
Diff to previous 1.3 (colored)

$OpenBSD$

Revision 1.3 / (download) - annotate - [select for diffs], Fri Sep 1 14:59:09 2000 UTC (23 years, 8 months ago) by millert
Branch: MAIN
Changes since 1.2: +189 -160 lines
Diff to previous 1.2 (colored)

More -Wall anmd KNF, from op2@tomahawk.SQUiSH.org

Revision 1.2 / (download) - annotate - [select for diffs], Thu Apr 13 06:12:16 2000 UTC (24 years, 1 month ago) by millert
Branch: MAIN
Changes since 1.1: +130 -117 lines
Diff to previous 1.1 (colored)

The start of KNF + -Wall.  The code has been run through indent but
needs hand fixup.  I stopped at keymap.c...

Revision 1.1 / (download) - annotate - [select for diffs], Fri Feb 25 19:08:50 2000 UTC (24 years, 2 months ago) by deraadt
Branch: MAIN

initial import of mg2a

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.