summaryrefslogtreecommitdiff
path: root/xedit.c
diff options
context:
space:
mode:
Diffstat (limited to 'xedit.c')
-rw-r--r--xedit.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/xedit.c b/xedit.c
index deac576..f71b696 100644
--- a/xedit.c
+++ b/xedit.c
@@ -128,9 +128,9 @@ main(int argc, char *argv[])
FileAccess file_access;
Widget source;
XtAppContext appcon;
- unsigned int i, num_loaded;
+ unsigned int i, num_loaded, lineno;
- num_loaded = 0;
+ num_loaded = lineno = 0;
#ifdef INCLUDE_XPRINT_SUPPORT
XtSetLanguageProc(NULL, NULL, NULL);
@@ -196,6 +196,16 @@ main(int argc, char *argv[])
for (i = 1; i < argc; i++) {
struct stat st;
+ if (argv[i][0] == '+') {
+ char *endptr;
+
+ lineno = strtol(argv[i], &endptr, 10);
+ /* Don't warn or anything about incorrect input? */
+ if (*endptr)
+ lineno = 0;
+ continue;
+ }
+
filename = ResolveName(argv[i]);
if (filename == NULL || FindTextSource(NULL, filename) != NULL)
continue;
@@ -289,8 +299,18 @@ main(int argc, char *argv[])
XtSetKeyboardFocus(topwindow, filenamewindow);
XtVaSetValues(textwindow, XtNwrap, XawtextWrapLine, NULL);
}
- else
+ else {
XtSetKeyboardFocus(topwindow, textwindow);
+ if (lineno) {
+ XawTextPosition position;
+
+ source = XawTextGetSource(textwindow);
+ position = RSCAN(XawTextGetInsertionPoint(textwindow),
+ lineno, False);
+ position = LSCAN(position, 1, False);
+ XawTextSetInsertionPoint(textwindow, position);
+ }
+ }
XtAppMainLoop(appcon);
return EXIT_SUCCESS;