}
void win_prop_set(char* xname, char* ename, char* value) {
+ if (!value) return;
Atom propname = XInternAtom(X.display, xname, 0);
XChangeProperty(X.display, X.self, propname, XA_STRING, 8, PropModeReplace,
(const unsigned char *)value, strlen(value));
if (!arg) arg = view->buffer.path;
if (!arg) return;
char* path = realpath(arg, NULL);
+ if (!path) path = strdup(arg);
free(view->buffer.path);
view->buffer.path = path;
buf_save(&(view->buffer));
- win_title(path);
- win_prop_set("TIDE_FILE", "file", path);
-}
-
-static void save(char* arg) {
- put(NULL);
+ if (view->buffer.status == NORMAL) {
+ char* path = realpath(view->buffer.path, NULL);
+ if (path) {
+ free(view->buffer.path);
+ view->buffer.path = path;
+ }
+ }
+ win_title(view->buffer.path);
+ win_prop_set("TIDE_FILE", "file", view->buffer.path);
}
static void get(char* arg) {
{ ModCtrl, 'e', cursor_eol },
/* Standard Text Editing Shortcuts */
- { ModCtrl, 's', save },
+ { ModCtrl, 's', put },
{ ModCtrl, 'z', undo },
{ ModCtrl, 'y', redo },
{ ModCtrl, 'x', cut },
/* if we still have args left we're going to open it in this instance */
if (*argv) {
char* path = realpath(*argv, NULL);
+ if (!path) path = strdup(*argv); // if file doesnt exist, use the original name
view_init(win_view(EDIT), path);
win_title(path);
win_prop_set("TIDE_FILE", "file", path);