summaryrefslogtreecommitdiff
path: root/usr.bin/mg
diff options
context:
space:
mode:
authorKjell Wooding <kjell@cvs.openbsd.org>2011-01-17 03:12:07 +0000
committerKjell Wooding <kjell@cvs.openbsd.org>2011-01-17 03:12:07 +0000
commit7a538d74905c998b64023418f8aa1fc19018fd64 (patch)
tree9f614aad52e266c96d4fdc50e73a9427ea87ee7b /usr.bin/mg
parent8f3bbcbc0561e5ad363ede507f45da8ff6a2354d (diff)
Add back-to-indentation. (M-m)
Move the dot to the first non-whitespace character on the current line. from Henri Kemppainen . ok theo
Diffstat (limited to 'usr.bin/mg')
-rw-r--r--usr.bin/mg/util.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/usr.bin/mg/util.c b/usr.bin/mg/util.c
index 3e0c691d8b3..3f2a14b09af 100644
--- a/usr.bin/mg/util.c
+++ b/usr.bin/mg/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.26 2008/09/15 16:13:35 kjell Exp $ */
+/* $OpenBSD: util.c,v 1.27 2011/01/17 03:12:06 kjell Exp $ */
/* This file is in the public domain. */
@@ -440,3 +440,16 @@ space_to_tabstop(int f, int n)
return (linsert((n << 3) - (curwp->w_doto & 7), ' '));
}
#endif /* NOTAB */
+
+/*
+ * Move the dot to the first non-whitespace character of the current line.
+ */
+int
+backtoindent(int f, int n)
+{
+ gotobol(FFRAND, 1);
+ while (curwp->w_doto < llength(curwp->w_dotp) &&
+ (isspace(lgetc(curwp->w_dotp, curwp->w_doto))))
+ ++curwp->w_doto;
+ return (TRUE);
+}