* Clear - Clear the current window's edit buffer
* Line - Get the current line number(s) containing the selection
* Kill - Kill a background command
-* Font - Toggle font between monospace and proportional or set the font
* ID - Get window id of the X window
* Zerox - Create a copy of the window
* Wily-like rc file for registering builtins
* Case insensitive search
-* use transaction ids to only mark buffer dirty when it really is
* 100% coverage with unit and unit-integration tests
-* tab inserts dont coalesce like one would expect
* move by words is inconsistent. Example:
var infoId = 'readerinfo'+reader.id;
Maybe think about addressing these later:
-* add current dir to path]'\\\''''''''''''''''''''''''''''' char is newline
+* add current dir to path
+* add support for guidefiles
+* Shift+Insert should insert primary selection
+* Find shortcut should select previous word if current char is newline
# Auxillary Programs
ClrCount
};
-extern char *TagString, *FontString;
+extern char *TagString, *Fonts[2];
extern int Palette[ClrCount];
extern int WinWidth, WinHeight, ScrollWidth, Timeout, TabWidth, ScrollBy,
ClickTime, CopyIndent, TrimOnSave, ExpandTabs, DosLineFeed;
void win_init(KeyBinding* bindings);
void win_title(char* path);
+void win_font(char* font);
void win_prop_set(char* xname, char* ename, char* value);
void win_update(int ms);
void win_loop(void);
#include <utf.h>
#include <edit.h>
-char* TagString = "Del Put Undo Redo Find ";
-char* FontString = "Verdana:size=11";
+char* TagString = "Del Put Undo Redo | Font Tabs | Find ";
+char* Fonts[2] = {
+ "Verdana:size=11",
+ "Liberation Mono:size=11"
+};
int /* Integer config options */
WinWidth = 640,
static KeyBinding* Keys = NULL;
static int Divider;
static Atom SelTarget;
+static int FontSel;
static struct XSel Selections[] = {
{ .name = "PRIMARY" },
{ .name = "CLIPBOARD" },
X.colormap = wa.colormap;
X.screen = DefaultScreen(X.display);
X.depth = DefaultDepth(X.display, X.screen);
- font_load(FontString);
+ font_load(Fonts[FontSel = 0]);
x11_window("unnamed");
/* initialize selection atoms */
for (int i = 0; i < (sizeof(Selections) / sizeof(Selections[0])); i++)
XStoreName(X.display, X.self, path);
}
+void win_font(char* font) {
+ if (font) {
+ font_load(font);
+ } else {
+ font_load(Fonts[++FontSel % nelem(Fonts)]);
+ }
+}
+
void win_prop_set(char* xname, char* ename, char* value) {
if (!value) return;
Atom propname = XInternAtom(X.display, xname, 0);
static void tag_exec(Tag* tag, char* arg) {
/* if we didnt get an arg, find one in the selection */
- if (!arg) arg = view_getstr(win_view(TAGS));
- if (!arg) arg = view_getstr(win_view(EDIT));
+ if (!arg || *arg) arg = view_getstr(win_view(TAGS));
+ if (!arg || *arg) arg = view_getstr(win_view(EDIT));
/* execute the tag handler */
- tag->action(arg);
+ tag->action(arg || *arg ? NULL : arg);
free(arg);
}
{ .tag = "Redo", .action = tag_redo },
{ .tag = "Tabs", .action = tabs },
{ .tag = "Undo", .action = tag_undo },
+ { .tag = "Font", .action = win_font },
{ .tag = NULL, .action = NULL }
};
static void usage(void) {
printf(
"Usage: %s [FLAGS] [FILE]\n"
- "\n -S 0,1 Enable/disable syntax highlighting"
"\n -I 0,1 Enable/disable automatic indenting"
"\n -W 0,1 Enable/disable trimming whitespace on save"
"\n -E 0,1 Enable/disable expanding tabs to spaces"
"\n -N 0,1 Enable/disable dos line ending style"
- "\n -F str Set the font to use"
"\n -T str String to use for the tags region"
"\n -C str Set the shell to use for command execution\n",
ARGV0);
case 'W': TrimOnSave = BOOLARG(); break;
case 'E': ExpandTabs = BOOLARG(); break;
case 'N': DosLineFeed = BOOLARG(); break;
- case 'F': FontString = STRARG(); break;
case 'T': TagString = STRARG(); break;
case 'C': ShellCmd[0] = STRARG(); break;
} OPTEND;