History

Fix several titling annoyances

malc committed 5 years ago

Commit b3fc2211 parent 4343ccd1 file · +19 −9Browse files

Unified · Split

main.ml+19−9
@@ -804,6 +804,20 @@ let fillhelp () = · 803 unmodified lines
804804 @ (("", 0, Noaction) :: loop [] sl) |> Array.of_list
805805 ;;
806806
807+let titlify path =
808+ if emptystr path
809+ then path
810+ else
811+ (if emptystr state.origin then path else state.origin)
812+ |> Filename.basename |> Ffi.mbtoutf8;
813+;;
814+
815+let settitle title =
816+ conf.title <- title;
817+ if not !ignoredoctitlte
818+ then Wsi.settitle @@ "llpp: " ^ title;
819+;;
820+
807821 let opendoc path password =
808822 state.path <- path;
809823 state.password <- password;
@@ -816,12 +830,7 @@ let opendoc path password = · 6 unmodified lines
816830 Ffi.setpapercolor conf.papercolor;
817831 Ffi.setdcf conf.dcf;
818832
819− let titlepath =
820− if emptystr state.origin
821− then path
822− else state.origin
823− in
824− Wsi.settitle ("llpp: " ^ Ffi.mbtoutf8 (Filename.basename titlepath));
833+ Wsi.settitle @@ titlify path;
825834 wcmd U.dopen "%d %d %s\000%s\000%s\000"
826835 (btod conf.usedoccss) !layouth
827836 path password conf.css;
@@ -1375,8 +1384,7 @@ let act cmds = · 547 unmodified lines
13751384 let s =
13761385 match splitatchar args '\t' with
13771386 | "Title", v ->
1378− conf.title <- v;
1379− if not !ignoredoctitlte then Wsi.settitle @@ "llpp: " ^ v;
1387+ settitle v;
13801388 args
13811389 | _, "" -> args
13821390 | c, v ->
@@ -4470,7 +4478,9 @@ let uioh = object · 3087 unmodified lines
44704478 method display = ()
44714479
44724480 method title =
4473− if emptystr conf.title then Ffi.mbtoutf8 state.path else conf.title
4481+ if emptystr conf.title
4482+ then titlify state.path
4483+ else conf.title
44744484
44754485 method key key mask =
44764486 begin match state.mode with

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t