Coder Social home page Coder Social logo

tab width too small about alexandrie HOT 6 CLOSED

plantec avatar plantec commented on August 30, 2024
tab width too small

from alexandrie.

Comments (6)

tinchodias avatar tinchodias commented on August 30, 2024

I realized that Sparta doesn't align but only replaces tab character by 4 spaces (see Character>>#textRunOn:).

Rubric does align:

Screen Shot 2022-07-22 at 18 19 25

Code:

stringWithTabs := '
A	A
AA	A
AAA	A
'.

RubEditingArea new
	font: (LogicalFont familyName: 'Source Sans Pro' pointSize: 20);
	updateTextWith: stringWithTabs;
	tabWidth: 100;
	openInWindow.
	
editor := AlbEditor new
	text: stringWithTabs asRopedText;
	yourself.
space := BlSpace new.
space root addChild: editor.
space show.

from alexandrie.

tinchodias avatar tinchodias commented on August 30, 2024

Debugging I see:

the editor has a current paragraph, then:
a paragraph has a RubTextComposer
--> a RubTextComposer has a TextStyle
----> TextStyle uses TextConstants
------> TextConstants defines DefaultTabsArray as #(24 48 72 96 120 144 168 ... 936 960)
and that's the default tab stops.

I wonder if our editor has equivalent text style and composer.

Pango seems to implement it similarly, you can just set a default tab width, or set an array of tab stops:
https://docs.gtk.org/Pango/struct.TabArray.html

btw, I've found interesting this elastic tabs, but didn't try it:
https://nickgravgaard.com/elastic-tabstops/

from alexandrie.

tinchodias avatar tinchodias commented on August 30, 2024

Do you think we can fix this more correctly like in Rubric? or it could be an easy workaround to do like Sparta, do a pass before rendering and convert each tab to certain number of spaces.

from alexandrie.

plantec avatar plantec commented on August 30, 2024

Character>>#textRunOn: ... :))
rrrrrrahhhh, shitty, could have seen it by myself

from alexandrie.

plantec avatar plantec commented on August 30, 2024

yes, Rubric handles tab a much clever way. I will think about that. it should be possible to change that.
Thanks, this is an Album issue now.
Regarding elastic tab: interesting, I will see how to allow such a feature in the futur

from alexandrie.

tinchodias avatar tinchodias commented on August 30, 2024

I will close this issue, as Alain fixed it.

text := stringWithTabs := '
A	A
AA	A
AAA	A
' asRopedText.
text onAlbum openInOblSpace.

Screen Shot 2022-10-14 at 16 50 20

from alexandrie.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.