diff --git a/fcore/app-type.sml b/fcore/app-type.sml index c06b18a..4f9acd2 100644 --- a/fcore/app-type.sml +++ b/fcore/app-type.sml @@ -1,7 +1,30 @@ -structure AppType = -struct +signature APP_TYPE = +sig + datatype mode = + NORMAL_MODE of string + type app_type = - { buffer: LineGap.t + { mode: mode + , buffer: LineGap.t + , windowWidth: int + , windowHeight: int + (* line to start drawing from *) + , startLine: int + (* absolute index of movable cursor *) + , cursorIdx: int + } + + val init: LineGap.t * int * int -> app_type +end + +structure AppType :> APP_TYPE = +struct + datatype mode = + NORMAL_MODE of string + + type app_type = + { mode: mode + , buffer: LineGap.t , windowWidth: int , windowHeight: int (* line to start drawing from *) @@ -11,7 +34,8 @@ struct } fun init (buffer, windowWidth, windowHeight) : app_type = - { buffer = buffer + { mode = NORMAL_MODE "" + , buffer = buffer , windowWidth = windowWidth , windowHeight = windowHeight , startLine = 0 diff --git a/fcore/app-with.sml b/fcore/app-with.sml index 25c6c51..9cdd9d4 100644 --- a/fcore/app-with.sml +++ b/fcore/app-with.sml @@ -4,10 +4,17 @@ struct fun bufferAndSize (app: app_type, newBuffer, newWidth, newHeight) = let - val {buffer = _, windowWidth = _, windowHeight = _, startLine, cursorIdx} = - app + val + { mode + , buffer = _ + , windowWidth = _ + , windowHeight = _ + , startLine + , cursorIdx + } = app in - { buffer = newBuffer + { mode = mode + , buffer = newBuffer , windowWidth = newWidth , windowHeight = newHeight , startLine = startLine @@ -17,10 +24,12 @@ struct fun bufferAndCursorIdx (app: app_type, newBuffer, newCursorIdx) = let - val {buffer = _, cursorIdx = _, windowWidth, windowHeight, startLine} = + val + {mode, buffer = _, cursorIdx = _, windowWidth, windowHeight, startLine} = app in - { buffer = newBuffer + { mode = mode + , buffer = newBuffer , cursorIdx = newCursorIdx , windowWidth = windowWidth , windowHeight = windowHeight diff --git a/shf b/shf index 8b391a1..87dfa96 100755 Binary files a/shf and b/shf differ