diff --git a/fcore/app-type.sml b/fcore/app-type.sml index ff3e5a7..24fbd70 100644 --- a/fcore/app-type.sml +++ b/fcore/app-type.sml @@ -1,6 +1,6 @@ structure AppType = struct - datatype mode = NORMAL_MODE of string + datatype mode = NORMAL_MODE of string | NORMAL_SEARCH_MODE of string type app_type = { mode: mode diff --git a/fcore/app-update.sml b/fcore/app-update.sml index b531ac7..b9a5c4f 100644 --- a/fcore/app-update.sml +++ b/fcore/app-update.sml @@ -2,6 +2,8 @@ structure AppUpdate = struct open AppType - fun update (app, msg, time) = - case #mode app of NORMAL_MODE str => NormalMode.update (app, str, msg, time) + fun update (app: app_type, msg, time) = + case #mode app of + NORMAL_MODE str => NormalMode.update (app, str, msg, time) + | NORMAL_SEARCH_MODE str => NormalSearchMode.update (app, str, msg, time) end diff --git a/fcore/normal-mode/normal-search-mode.sml b/fcore/normal-mode/normal-search-mode.sml new file mode 100644 index 0000000..ba8e116 --- /dev/null +++ b/fcore/normal-mode/normal-search-mode.sml @@ -0,0 +1,12 @@ +structure NormalSearchMode = +struct + open AppType + open InputMsg + + fun update (app, searchString, msg, time) = + case msg of + CHAR_EVENT chrCmd => app + | KEY_ESC => Finish.clearMode app + | RESIZE_EVENT (width, height) => app + | WITH_SEARCH_LIST searchList => app +end diff --git a/shf.mlb b/shf.mlb index a4e7713..7e725c1 100644 --- a/shf.mlb +++ b/shf.mlb @@ -42,6 +42,7 @@ fcore/move.sml fcore/normal-mode/normal-move.sml fcore/normal-mode/normal-delete.sml fcore/normal-mode/normal-mode.sml +fcore/normal-mode/normal-search-mode.sml fcore/app-update.sml