Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iceberg's commit window has non-functional horizontal scroll bars #10666

Closed
lopezca opened this issue Dec 16, 2021 · 2 comments · Fixed by #11583
Closed

Iceberg's commit window has non-functional horizontal scroll bars #10666

lopezca opened this issue Dec 16, 2021 · 2 comments · Fixed by #11583

Comments

@lopezca
Copy link
Contributor

lopezca commented Dec 16, 2021

Bug description
When looking at a diff using iceberg's commit window, the horizontal scrollbar has incorrect bounds and does not allow for scrolling, therefore it's impossible to see the changes in long lines.

To Reproduce
Steps to reproduce the behavior:

  1. Go to Iceberg
  2. Click on: a repository where you'd like to do a commit.
  3. Click on commit.
  4. Select a change with a long line
  5. Try to scroll horizontally to see the changes.

Expected behavior
Window should allow looking at all the code in the diff sections.

Screenshots
image

Version information:

  • OS: Windows
  • Version: 10
  • Pharo Version:
    • Pharo-9.0.0+build.1573.sha.0e09d756fc99383cbb498565200d9e5e9841ce11 (64 Bit)

Expected development cost
🤷‍♂️

@bouraqadi
Copy link
Contributor

Same with compare two commits. Scroll bars are either hidden or don't go far envough
Screenshot 2022-02-16 at 17 50 30

@fmqa
Copy link
Contributor

fmqa commented Aug 22, 2022

It seems like RubAbstractTextArea & friends do not offer any kind of "size to fit" method, causing issues like this. Devising a fix is not so easy, but can be done by performing a rudimentary implementation of this functionality:

RubAbstractTextArea >> maxLineWidth [
	| w |
	w := 0.
	self string linesDo: [ :line | w := w max: (self font widthOfString: line) ].
	"check this later, not really sure about this calculation"
	^ w * 6 // 5
]
RubAbstractTextArea >> handleEdit: editBlock [
	"Ensure that changed areas get suitably redrawn"

	editBlock value.
	"Fit to width on edit"
	(self grow isNotNil & self grow) ifTrue: [
		self width: (1 max: self maxLineWidth + self margins left + self margins right)
	].
	self selectionChanged	"Note new selection"
]
RubAbstractTextArea >> grow

	^ grow
RubAbstractTextArea >> grow: aBool

	grow := aBool
RubScrolledTextMorph >> defaultScrollTarget
	| textArea |
	textArea := self textAreaClass new.
	textArea grow: true. "Ensure morph width tracks line width"
	textArea backgroundColor: Color lightGray veryMuchLighter.
	^ textArea

This might not be exactly the cleanest solution, but it does resolve the issue for the most part and makes viewing changesets in Iceberg (and Epicea) less tedious.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants