OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.49 / (download) - annotate - [select for diffs], Fri Apr 21 13:39:37 2023 UTC (12 months, 4 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.48: +2 -2 lines
Diff to previous 1.48 (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.48 / (download) - annotate - [select for diffs], Mon Apr 17 09:49:04 2023 UTC (13 months ago) by op
Branch: MAIN
Changes since 1.47: +2 -6 lines
Diff to previous 1.47 (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.47 / (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.46: +1 -8 lines
Diff to previous 1.46 (colored)

Delete obsolete /* ARGSUSED */ lint comments.

ok miod@ millert@

Revision 1.46 / (download) - annotate - [select for diffs], Sat Nov 17 09:52:34 2018 UTC (5 years, 6 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
Changes since 1.45: +5 -1 lines
Diff to previous 1.45 (colored)

fix undo in transpose-paragraph.

Revision 1.45 / (download) - annotate - [select for diffs], Tue Sep 6 16:25:47 2016 UTC (7 years, 8 months ago) by lum
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
Changes since 1.44: +7 -7 lines
Diff to previous 1.44 (colored)

If you have a paragraph:

123
456

With the cursor on either the 4, 5 or 6 and no newline after the '6',
and then execute forward-paragraph (M-}), the cursor sits still and
does not move to the end of the second line (after the 6), which is in
effect the end of parapraph. This diff fixes that behaviour.

Revision 1.44 / (download) - annotate - [select for diffs], Thu Apr 14 17:05:32 2016 UTC (8 years, 1 month ago) by lum
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.43: +14 -3 lines
Diff to previous 1.43 (colored)

Add 'sentence-end-double-space'.

If you prefer "lighter" punctuation and one space between sentences,
for example:

Mr and Mrs Jones are from the UK. They arrived today.

over more liberal use of full stops and double spaces between
sentences:

Mr. and Mrs. Jones are from the U.K.  They arrived today.

then toggling 'sentence-end-double-space' will make mg's
fill-paragraph function format text using one space instead of two
(the default) between sentences. However, be careful, should you have
a double spaced document and accidentally "format" it to have single
spaces, then you may have a problem. mg won't be able to revert the
formatting for you (unless you have a previous version of the text in
the "undo" history, or are using mg's backup facility and haven't
opened and saved multiple times!).

Comments from schwarze@

Revision 1.43 / (download) - annotate - [select for diffs], Tue Apr 12 06:20:50 2016 UTC (8 years, 1 month ago) by lum
Branch: MAIN
Changes since 1.42: +3 -3 lines
Diff to previous 1.42 (colored)

Stop mg putting a space at the end of a paragraph when using
fill-paragraph.  Reported by Harald Dunkel.

Revision 1.42 / (download) - annotate - [select for diffs], Mon Dec 14 03:25:59 2015 UTC (8 years, 5 months ago) by mmcc
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.41: +2 -2 lines
Diff to previous 1.41 (colored)

s/begining/beginning/g

Revision 1.41 / (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.40: +13 -1 lines
Diff to previous 1.40 (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.40 / (download) - annotate - [select for diffs], Sat Sep 26 15:03:15 2015 UTC (8 years, 7 months ago) by lum
Branch: MAIN
Changes since 1.39: +43 -1 lines
Diff to previous 1.39 (colored)

Add transpose-paragraphs. ok jasper@

Revision 1.39 / (download) - annotate - [select for diffs], Thu Sep 24 07:20:12 2015 UTC (8 years, 7 months ago) by lum
Branch: MAIN
Changes since 1.38: +6 -4 lines
Diff to previous 1.38 (colored)

Make comments more accurate.

Revision 1.38 / (download) - annotate - [select for diffs], Thu Sep 24 07:07:59 2015 UTC (8 years, 7 months ago) by lum
Branch: MAIN
Changes since 1.37: +39 -2 lines
Diff to previous 1.37 (colored)

Add mark-paragraph. ok jasper@

Revision 1.37 / (download) - annotate - [select for diffs], Thu Sep 24 01:24:10 2015 UTC (8 years, 7 months ago) by lum
Branch: MAIN
Changes since 1.36: +46 -19 lines
Diff to previous 1.36 (colored)

Fix multiple iterations of kill-paragraph. ok jasper@

Revision 1.36 / (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.35: +5 -1 lines
Diff to previous 1.35 (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.35 / (download) - annotate - [select for diffs], Sun Nov 16 04:16:41 2014 UTC (9 years, 6 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.34: +2 -1 lines
Diff to previous 1.34 (colored)

Stop using <sys/param.h>; replace MAXPATHLEN with PATH_MAX, stop using MAX(),
and pull in <limits.h> for *_MAX constants.

inspired on a diff from Kamil Rytarowski (n54 (at) gmx.com)
ok bcallah@

Revision 1.34 / (download) - annotate - [select for diffs], Fri Oct 17 13:25:13 2014 UTC (9 years, 7 months ago) by lum
Branch: MAIN
Changes since 1.33: +14 -6 lines
Diff to previous 1.33 (colored)

If gotoeop() is called requiring more than one iteration, it behaves
oddly if it reaches the end of buffer before completing all
iterations. This diff makes the kill-paragraph and forward-paragraph
commands stop once they can go no further. ok florian@

Revision 1.33 / (download) - annotate - [select for diffs], Mon Oct 13 21:01:05 2014 UTC (9 years, 7 months ago) by lum
Branch: MAIN
Changes since 1.32: +5 -1 lines
Diff to previous 1.32 (colored)

gotoeop() does not behave as expected when there is no '\n' at the end of the
buffer. ok florian@

Revision 1.32 / (download) - annotate - [select for diffs], Sun Oct 12 18:09:41 2014 UTC (9 years, 7 months ago) by lum
Branch: MAIN
Changes since 1.31: +4 -3 lines
Diff to previous 1.31 (colored)

Fix a bug in backward-paragraph. If the cursor is on the first line of
a paragraph, it jumps to the start of the previous paragraph if you
press M-{. Input and fix to my diff from florian@

Revision 1.31 / (download) - annotate - [select for diffs], Thu Mar 27 09:30:55 2014 UTC (10 years, 1 month ago) by florian
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.30: +3 -3 lines
Diff to previous 1.30 (colored)

Don't use nospace uninitialized in gotobop and gotoeop.
Problem noticed and diff from bcallah@.
Slightly different fix by me.
OK lum@, bcallah@

Revision 1.30 / (download) - annotate - [select for diffs], Thu Mar 20 07:47:29 2014 UTC (10 years, 2 months ago) by lum
Branch: MAIN
Changes since 1.29: +2 -1 lines
Diff to previous 1.29 (colored)

Add some missing dobeeps.
ok florian@

Revision 1.29 / (download) - annotate - [select for diffs], Sat Jun 15 19:58:39 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.28: +2 -1 lines
Diff to previous 1.28 (colored)

Move upwards passed multiple lines with no characters instead of
stopping when first line with no characters is found.

Revision 1.28 / (download) - annotate - [select for diffs], Sat Jun 1 14:27:32 2013 UTC (10 years, 11 months ago) by lum
Branch: MAIN
Changes since 1.27: +1 -4 lines
Diff to previous 1.27 (colored)

Make 'kill-paragraph' behave like emacs. ok florian@

Revision 1.27 / (download) - annotate - [select for diffs], Sat Jun 1 10:23:40 2013 UTC (10 years, 11 months ago) by lum
Branch: MAIN
Changes since 1.26: +8 -7 lines
Diff to previous 1.26 (colored)

Update the forw/backpara comments to reflect recent changes.

Revision 1.26 / (download) - annotate - [select for diffs], Sat Jun 1 09:50:47 2013 UTC (10 years, 11 months ago) by lum
Branch: MAIN
Changes since 1.25: +3 -5 lines
Diff to previous 1.25 (colored)

tidy-up int declarations as suggested by florian@

Revision 1.25 / (download) - annotate - [select for diffs], Sat Jun 1 09:46:31 2013 UTC (10 years, 11 months ago) by lum
Branch: MAIN
Changes since 1.24: +20 -24 lines
Diff to previous 1.24 (colored)

Adjust M-} (forward-paragraph) to behave like emacs.
Bug fix and ok florian@

Revision 1.24 / (download) - annotate - [select for diffs], Sun May 19 10:27:11 2013 UTC (11 years ago) by lum
Branch: MAIN
Changes since 1.23: +22 -26 lines
Diff to previous 1.23 (colored)

Make the cursor position when moving backwards by paragraph behave the
same as emacs: move to line above paragraph. ok florian@

Revision 1.23 / (download) - annotate - [select for diffs], Sun Feb 17 15:42:21 2013 UTC (11 years, 3 months ago) by lum
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.22: +10 -16 lines
Diff to previous 1.22 (colored)

Fix line counting when using forward-paragraph and backward-paragraph.
Feedback and ok florian@

Revision 1.22 / (download) - annotate - [select for diffs], Tue Nov 29 05:59:54 2011 UTC (12 years, 5 months ago) by lum
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.21: +2 -2 lines
Diff to previous 1.21 (colored)

Missing wordlen check from version 1.20. Spotted by matthew@

Revision 1.21 / (download) - annotate - [select for diffs], Mon Nov 28 23:37:32 2011 UTC (12 years, 5 months ago) by matthew
Branch: MAIN
Changes since 1.20: +3 -3 lines
Diff to previous 1.20 (colored)

Fix a few grating comment typos.

Revision 1.20 / (download) - annotate - [select for diffs], Mon Nov 28 05:04:17 2011 UTC (12 years, 5 months ago) by lum
Branch: MAIN
Changes since 1.19: +6 -2 lines
Diff to previous 1.19 (colored)

Change behaviour of M-q (fill-paragraph) to allow
double-space after /[.?!]\)?/

From a diff sent to tech@ by Matthew Dempsky some
months ago.

Revision 1.19 / (download) - annotate - [select for diffs], Thu Jun 4 02:23:37 2009 UTC (14 years, 11 months ago) by kjell
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8, OPENBSD_4_7_BASE, OPENBSD_4_7, OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.18: +4 -4 lines
Diff to previous 1.18 (colored)

Rename w_flag to w_rflag. This is not a general purpose
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.

Revision 1.18 / (download) - annotate - [select for diffs], Tue Jun 2 21:55:25 2009 UTC (14 years, 11 months ago) by kjell
Branch: MAIN
Changes since 1.17: +7 -3 lines
Diff to previous 1.17 (colored)

we were erroneously setting fill-column, even when the input
to set-fill-column was garbage. (common, since they keystroke is
so close to find-file). Fix!

Revision 1.17 / (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.16: +3 -5 lines
Diff to previous 1.16 (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.16 / (download) - annotate - [select for diffs], Thu Jun 12 21:36:47 2008 UTC (15 years, 11 months ago) by kjell
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.15: +17 -3 lines
Diff to previous 1.15 (colored)

Make set-fill-column interactive (and scriptable in a startup file)
This replaces the ridiculous "move cursor to where you want to wrap things
and invoke this comment" behavior of before.

Note, this makes auto-fill-mode the moral equivalent of mail-mode.
(and set-fill-column the moral equivalent of mail-set-margin)

Revision 1.15 / (download) - annotate - [select for diffs], Fri Nov 17 08:45:31 2006 UTC (17 years, 6 months ago) by kjell
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2, OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.14: +3 -3 lines
Diff to previous 1.14 (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.14 / (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.13: +5 -5 lines
Diff to previous 1.13 (colored)

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

Revision 1.13 / (download) - annotate - [select for diffs], Fri Nov 18 20:56:53 2005 UTC (18 years, 6 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.12: +2 -2 lines
Diff to previous 1.12 (colored)

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

Revision 1.12 / (download) - annotate - [select for diffs], Tue Oct 18 18:54:48 2005 UTC (18 years, 7 months ago) by kjell
Branch: MAIN
Changes since 1.11: +14 -4 lines
Diff to previous 1.11 (colored)

make fill-paragraph undoable

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

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

Revision 1.10 / (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.9: +24 -24 lines
Diff to previous 1.9 (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.9 / (download) - annotate - [select for diffs], Fri Oct 24 20:32:06 2003 UTC (20 years, 6 months ago) by avsm
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.8: +4 -4 lines
Diff to previous 1.8 (colored)

dont compare int to NULL, millert@ ok

Revision 1.8 / (download) - annotate - [select for diffs], Tue May 20 03:08:55 2003 UTC (21 years ago) by cloder
Branch: MAIN
CVS Tags: OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.7: +7 -13 lines
Diff to previous 1.7 (colored)

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

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
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3, OPENBSD_3_2_BASE, OPENBSD_3_2, OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.6: +15 -15 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
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0
Changes since 1.5: +12 -12 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: +18 -18 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
CVS Tags: OPENBSD_2_9_BASE, OPENBSD_2_9
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
CVS Tags: OPENBSD_2_8_BASE, OPENBSD_2_8
Changes since 1.2: +102 -72 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
CVS Tags: OPENBSD_2_7_BASE, OPENBSD_2_7
Changes since 1.1: +95 -75 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.