Skip to content

Commit

Permalink
Merge branch 'dev' into US60
Browse files Browse the repository at this point in the history
  • Loading branch information
frcroth committed Jun 15, 2020
2 parents 570d9f2 + 9b023d0 commit 9a76c6b
Show file tree
Hide file tree
Showing 33 changed files with 145 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ keyStroke: aKeyboardEvent
(self isCtrlA: aKeyboardEvent)
ifTrue: [self selectAll].
self model precedingStructuresChanged.
self model updateFooter.
^ returnValue
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ mouseDown: anEvent
returnValue := super mouseDown: anEvent.
self model precedingStructuresChanged.
self model ifNotNil: #unbufferStructures.
self model updateFooter.
^ returnValue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"crWithIndent:" : "lh 7/24/2019 22:30",
"getParagraphCharacter" : "LM 5/26/2019 22:52",
"isCtrlA:" : "lh 7/24/2019 16:59",
"keyStroke:" : "JEH 6/14/2020 09:53",
"mouseDown:" : "JEH 6/14/2020 10:07",
"returnValue" : "ls 6/19/2019 19:14",
"isNewCharacter:" : "tok 6/13/2020 12:03",
"isSpecialCharacter:" : "OS 6/12/2020 12:03",
"isStructureShortcut:" : "OS 6/12/2020 12:09",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ buildFooterWith: aBuilder
model: self;
frame: (0 @ 0.9 corner: 1 @ 1);
readOnly: true;
getText: #footerText;
minimumHeight: 20;
indicateUnacceptedChanges: false;
yourself
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ buildWith: aBuilder
result := aBuilder build: windowSpec.
self textView: (aBuilder widgetAt: 'textView').
self footer: (aBuilder widgetAt: 'footer').
self updateFooter.
self editor model: self.

^ result
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
document information
currentPositionInText

^ self positionInTextAtIndex: self selectionStart
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
displayedLines

^ self editor paragraph lines
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
document information
footerText

| footerString|
| footerString currentPositionInText|
footerString := 'You are using SquidWord · '.
footerString := (footerString, self bufferDocument wordcount), ' words · '.
footerString := footerString, self documentTimeText.
footerString := (footerString, self bufferDocument wordcount), ' words ·'.

currentPositionInText := self currentPositionInText.
footerString := (footerString, ' Line '), currentPositionInText y.
footerString := (footerString, ' Col '), currentPositionInText x.
footerString := footerString, ' · ' , self documentTimeText.

^ footerString
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
document information
positionInTextAtIndex: anIndex

| lineCounter currentLine positionInLine |

lineCounter := 0.
currentLine := self displayedLines
detect:
[: each | lineCounter := lineCounter + 1.
each first <= (anIndex + 1) and: [each last >= (anIndex + 1)]]
ifNone: [self displayedLines last].
positionInLine := anIndex - currentLine first + 2.

^ positionInLine @ lineCounter
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"bufferDocument:" : "ls 7/24/2019 20:57",
"bufferedStructures" : "ls 6/19/2019 17:30",
"bufferedStructures:" : "ls 6/26/2019 17:46",
"buildFooterWith:" : "frc 5/25/2020 15:02",
"buildFooterWith:" : "JEH 6/14/2020 11:33",
"buildHelpButtonWith:" : "kh 6/1/2020 14:21",
"buildInfoButtonWith:" : "kh 6/1/2020 14:21",
"buildInspectDocumentButtonWith:" : "ls 6/26/2019 18:57",
Expand All @@ -30,21 +30,23 @@
"buildStructureListWith:" : "OS 6/3/2020 23:50",
"buildTextFieldWith:" : "tok 5/31/2020 20:20",
"buildUndoButtonWith:" : "MB 5/22/2019 21:03",
"buildWith:" : "kh 5/25/2020 16:36",
"buildWith:" : "JEH 6/14/2020 11:32",
"chosenDocument" : "AG 7/25/2019 13:13",
"createNewStructure:" : "ls 7/24/2019 15:11",
"currentPositionInText" : "JEH 6/14/2020 11:15",
"currentSaveName" : "ls 6/26/2019 17:58",
"currentSaveName:" : "ls 6/26/2019 17:58",
"currentStructures" : "OS 6/1/2020 00:02",
"debufferedStructures" : "OS 5/31/2020 13:08",
"debufferedStructures:" : "OS 5/31/2020 13:08",
"displayedLines" : "JEH 6/14/2020 09:57",
"documentClass" : "ls 7/10/2019 15:53",
"documentTimeText" : "OS 6/14/2020 18:22",
"editor" : "lh 7/24/2019 17:17",
"fitParagraphs" : "lh 7/24/2019 22:44",
"footer" : "frc 5/25/2020 15:40",
"footer:" : "frc 5/25/2020 15:22",
"footerText" : "OS 6/14/2020 18:23",
"footerText" : "JEH 6/14/2020 11:16",
"getStructureSelectionAt:" : "OS 6/3/2020 23:53",
"hasStructure:" : "AG 7/25/2019 13:13",
"hasStructure:between:to:" : "6/1/2020 14:03:21",
Expand All @@ -64,6 +66,7 @@
"okToChange" : "ls 6/12/2019 22:15",
"openNewEditor" : "ls 6/12/2019 18:10",
"openStructureEditor" : "ls 7/24/2019 16:53",
"positionInTextAtIndex:" : "JEH 6/14/2020 18:14",
"precedingStructures" : "OS 5/31/2020 23:22",
"precedingStructures:" : "OS 5/31/2020 23:22",
"precedingStructuresChanged" : "OS 6/1/2020 00:04",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tests
footerContainsColNumber

^ self regExFoundInFooter: 'Col [0-9]+'

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tests
footerContainsLineNumber

^ self regExFoundInFooter: 'Line [0-9]+'

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
tests
regExFoundInFooter: aRegEx

| currentFooterText |

currentFooterText := self editorModel footer textMorph text.
^ (RxMatcher forString: aRegEx) search: currentFooterText

Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ testUS04loadedTextIsInsertedIntoEditor
self editorModel setText: self anotherText.
self loadDocumentFromSaver.

self assert: self text equals: self editorModel text
self assert: self editorModel text equals: self text
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tests
testUS62ColNumberIsShownInFooter

self assert: self footerContainsColNumber

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tests
testUS62LineNumberIsShownInFooter

self assert: self footerContainsLineNumber

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"document" : "ls 7/24/2019 17:23",
"editorSavesIncludeKey:" : "MB 5/22/2019 18:01",
"enterSaveNameInDialog:" : "MB 7/24/2019 22:49",
"footerContainsColNumber" : "JEH 6/14/2020 12:43",
"footerContainsLineNumber" : "JEH 6/14/2020 12:43",
"helpButtonLabel" : "kh 5/25/2020 22:42",
"instance:equals:" : "lh 7/24/2019 18:46",
"loadDocumentFromSaver" : "ls 7/3/2019 21:46",
Expand All @@ -19,6 +21,7 @@
"paragraphCharacter" : "lh 7/24/2019 20:02",
"pressEnter" : "MB 5/15/2019 20:55",
"pressShiftEnter" : "MB 5/15/2019 20:54",
"regExFoundInFooter:" : "JEH 6/14/2020 12:43",
"registeredOpenCommandsOfWorldMenuIncludes:" : "MB 5/15/2019 21:27",
"removeStructure" : "ls 7/24/2019 17:24",
"richTextEditorOpenCommand" : "ls 6/22/2019 10:49",
Expand All @@ -27,7 +30,7 @@
"simulateKeyboardEventWithButtons:andKeyValue:" : "lh 7/24/2019 18:30",
"testInspectDocument" : "frc 6/13/2020 11:08",
"testUS04loadButtonExists" : "AG 5/22/2019 18:38",
"testUS04loadedTextIsInsertedIntoEditor" : "lh 7/24/2019 18:35",
"testUS04loadedTextIsInsertedIntoEditor" : "JEH 6/14/2020 18:13",
"testUS04saveAsButtonExists" : "SR 5/22/2019 21:07",
"testUS04saveAsButtonLetsChooseNameAndSavesInImage" : "SR 5/22/2019 21:08",
"testUS04saveButtonExists" : "AG 5/22/2019 18:39",
Expand All @@ -51,6 +54,8 @@
"testUS47WhenStructureIsRemovedTheTriangleShows" : "ls 7/25/2019 13:20",
"testUS60disableAutocompletion" : "kh 6/15/2020 13:47",
"testUS60enableAutocompletion" : "kh 6/15/2020 13:47",
"testUS62ColNumberIsShownInFooter" : "JEH 6/14/2020 12:36",
"testUS62LineNumberIsShownInFooter" : "JEH 6/14/2020 12:40",
"testUS63InfoButtonExists" : "6/1/2020 14:03:20",
"testUS67HelpBrowserIsOpended" : "kh 5/25/2020 22:44",
"testUS67HelpButtonExists" : "kh 5/25/2020 22:35",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ headingIsAddedToWrittenText
^ self editorModel bufferDocument
hasStructure: #heading1
forText: self editorText
from: self caretPosition
to: self otherText size - 1
from: self caretPosition + 1
to: (self caretPosition + self otherText size - 2)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
utilities
moveCaret

self moveCaretMulipleTimesRight: 5.
self moveCaretMulipleTimesLeft: 3
self moveCaretMultipleTimesRight: 5.
self moveCaretMultipleTimesLeft: 3

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
utilities
moveCaretMultipleTimesLeft: aNumber

self enterCharacter: self leftArrowKey times: aNumber
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
utilities
moveCaretMultipleTimesRight: aNumber

self enterCharacter: self rightArrowKey times: aNumber
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ utilities
moveCaretToBeginningOfOtherText

self
moveCaretMulipleTimesLeft: self otherText size;
caretPosition: self caretPosition - self otherText size
moveCaretMultipleTimesLeft: self otherText size
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ utilities
moveCaretToBeginningOfText

self
moveCaretMulipleTimesLeft: self editorText size;
moveCaretMultipleTimesLeft: self editorText size;
caretPosition: 1
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ utilities
moveCaretToEndOfText

self
moveCaretMulipleTimesRight: self editorText size;
moveCaretMultipleTimesRight: self editorText size;
caretPosition: self editorText size.
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ moveCaretToMidOfText

self
moveCaretToBeginningOfText;
moveCaretMulipleTimesRight: self middleTextOffset;
moveCaretMultipleTimesRight: self middleTextOffset;
caretPosition: self middleTextOffset.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
constants
multipleLineText

^ 'This is a text
that crosses
multiple lines
.'

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
utilities
rightArrowKey

^ Character arrowRight
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
unit-tests
testCorrectLineColNumberAtArbitraryPositionInText

self
enterStringOntoTextField: self multipleLineText;
moveCaretToBeginningOfText;
moveCaretMultipleTimesRight: (self standardText size + 22);
assert: (self editorModel currentPositionInText) = (7@3)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
unit-tests
testCorrectLineColNumberAtEndOfText

self
enterStringOntoTextField: self multipleLineText;
moveCaretToEndOfText;
assert: (self editorModel currentPositionInText) = (2@7)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
unit-tests
testCorrectLineColNumberAtStartOfText

self
enterStringOntoTextField: self multipleLineText;
moveCaretToBeginningOfText;
assert: (self editorModel currentPositionInText) = (1@1)
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,32 @@
"enterSaveNameInDialog:" : "MB 7/24/2019 23:45",
"extendableBoldSet" : "lh 6/5/2019 22:06",
"extendableBoldTextStructure" : "tok 6/8/2020 12:06",
"headingIsAddedToWrittenText" : "MB 7/24/2019 18:21",
"headingIsAddedToWrittenText" : "JEH 6/14/2020 14:00",
"headingTextStructureIndex" : "ls 6/26/2019 22:25",
"leftArrowKey" : "MB 6/19/2019 18:08",
"middleTextOffset" : "MB 6/19/2019 18:06",
"moveCaret" : "MB 7/25/2019 11:44",
"moveCaretMulipleTimesLeft:" : "ls 6/21/2019 16:36",
"moveCaretMulipleTimesRight:" : "ls 6/21/2019 16:36",
"moveCaretToBeginningOfOtherText" : "ls 6/21/2019 17:20",
"moveCaretToBeginningOfText" : "ls 6/21/2019 17:20",
"moveCaretToEndOfText" : "ls 6/21/2019 17:17",
"moveCaretToMidOfText" : "ls 6/21/2019 17:17",
"moveCaret" : "JEH 6/14/2020 14:04",
"moveCaretMultipleTimesLeft:" : "JEH 6/14/2020 14:04",
"moveCaretMultipleTimesRight:" : "JEH 6/14/2020 14:04",
"moveCaretToBeginningOfOtherText" : "JEH 6/14/2020 14:04",
"moveCaretToBeginningOfText" : "JEH 6/14/2020 14:04",
"moveCaretToEndOfText" : "JEH 6/14/2020 14:04",
"moveCaretToMidOfText" : "JEH 6/14/2020 14:04",
"multipleLineText" : "JEH 6/14/2020 18:12",
"otherText" : "ls 6/21/2019 17:14",
"rightArrowKey" : "JEH 6/14/2020 13:07",
"setUp" : "MB 7/25/2019 12:15",
"standardText" : "ls 6/21/2019 17:14",
"testCorrectLineColNumberAtArbitraryPositionInText" : "JEH 6/14/2020 18:12",
"testCorrectLineColNumberAtEndOfText" : "JEH 6/14/2020 18:11",
"testCorrectLineColNumberAtStartOfText" : "JEH 6/14/2020 18:11",
"testUS23TriangleDisappearsAfterSuccesfulSave" : "ls 7/25/2019 13:20",
"testUS23TriangleIsStillVisibleWhenSaveDialogIsCancelled" : "AG 6/21/2019 14:16",
"testUS23TriangleReappearsWhenEditing" : "AG 6/21/2019 14:33",
"testUS23WhenTriangleIsVisibleCtrlSCanBePressedForSaveDialog" : "lh 7/24/2019 16:19",
"testUS36StructureIsNotExtendable" : "lh 6/5/2019 22:03",
"testUS49ApplySelectedStructureWithoutASelectionToNextTextBeginning" : "MB 7/25/2019 10:33",
"testUS49ApplySelectedStructureWithoutASelectionToNextTextEnd" : "MB 7/25/2019 10:33",
"testUS49ApplySelectedStructureWithoutASelectionToNextTextBeginning" : "JEH 6/14/2020 14:00",
"testUS49ApplySelectedStructureWithoutASelectionToNextTextEnd" : "JEH 6/14/2020 13:56",
"testUS49ApplySelectedStructureWithoutASelectionToNextTextMiddle" : "MB 7/25/2019 10:33",
"testUS49NoStructureApplyWhenCaretMovedBeginning" : "MB 7/25/2019 10:32",
"testUS49NoStructureApplyWhenCaretMovedEnd" : "MB 7/25/2019 10:32",
Expand Down

0 comments on commit 9a76c6b

Please sign in to comment.