Skip to content

Commit

Permalink
simplifies diff text origins
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeAtHPI committed Nov 23, 2023
1 parent 3e1a730 commit a0a3b16
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 22 deletions.
24 changes: 11 additions & 13 deletions packages/Sandblocks-Core/SBTabView.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,8 @@ SBTabView >> paddedDiffTexts [
| diffs maxLines |
diffs := self namedBlocks collect: [:aNamedBlock |
(TextDiffBuilder
from: (self plainSourceStringFor: aNamedBlock)
to: (self plainSourceStringFor: self active)) buildDisplayPatch].
from: (self sourceStringFor: aNamedBlock)
to: (self sourceStringFor: self active)) buildDisplayPatch].

maxLines := (diffs collect: [:aText | aText lineCount]) max.

Expand All @@ -419,17 +419,6 @@ SBTabView >> paddedDiffTexts [
paddedText]
]

{ #category : #diffing }
SBTabView >> plainSourceStringFor: aNamedBlock [

^ aNamedBlock block isBlockBody
ifFalse: [aNamedBlock block sourceString]
ifTrue: [ ((aNamedBlock block statements
reject: #isUnknown)
collect: #unwrappedSourceString)
fold: [:a :b | a, Character cr, b]]
]

{ #category : #ui }
SBTabView >> rebuild [

Expand Down Expand Up @@ -479,6 +468,15 @@ SBTabView >> setActive: aNamedBlock [
(self switchCommandFor: (self namedBlocks indexOf: aNamedBlock ifAbsent: 1))
]

{ #category : #diffing }
SBTabView >> sourceStringFor: aNamedBlock [

^ aNamedBlock block isBlockBody
ifFalse: [aNamedBlock block sourceString]
ifTrue: [ (aNamedBlock block statements collect: #sourceString)
fold: [:a :b | a, Character cr, b]]
]

{ #category : #commands }
SBTabView >> switchCommandFor: aNumber [

Expand Down
9 changes: 0 additions & 9 deletions packages/Sandblocks-Smalltalk/SBStMessageSend.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -553,15 +553,6 @@ SBStMessageSend >> tryReplacements [
option automatic ifTrue: [option apply: c]]
]

{ #category : #converting }
SBStMessageSend >> unwrappedSourceString [

^ String streamContents: [:aStream |
self actualReceiver writeSourceOn: aStream.
aStream space.
signature writeSourceOn: aStream.]
]

{ #category : #accessing }
SBStMessageSend >> useAsVariable [
<action>
Expand Down

0 comments on commit a0a3b16

Please sign in to comment.