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

Split CharAtlas types and utility functions off #1307

Merged
merged 4 commits into from
Mar 8, 2018

Conversation

bgw
Copy link
Member

@bgw bgw commented Mar 5, 2018

I'm starting to pull some changes off of my large WIP branch/commit that adds an alternative dynamic character atlas (#1294). We're going to need to support multiple CharAtlas implementations, and this should make that easier.

I'm starting to pull some changes off of my large WIP branch/commit that
adds an alternative dynamic character atlas. We're going to need to
support multiple CharAtlas implementations, and this should make that
easier.
@mofux
Copy link
Contributor

mofux commented Mar 5, 2018

Looks good, but I'd rather merge this as part of your final PR to be honest. I'm a little bit concerned this grows the code base without much gain otherwise. @Tyriar Any thoughts?

@bgw
Copy link
Member Author

bgw commented Mar 6, 2018

Looks good, but I'd rather merge this as part of your final PR to be honest.

If you'd like, I can close this and wait until the rest of my changes for #1294 are ready, and then have one PR with a bunch of commits.

I just figured it might be easier to review if I got a few small changes out of the way first. (this and #1308).

@Tyriar
Copy link
Member

Tyriar commented Mar 6, 2018

It doesn't look like this would affect the overall size of the codebase, seems like it's mostly moving code around rather than adding. Splitting the big change into several smaller changes will make them much easier to merge in.

@Tyriar
Copy link
Member

Tyriar commented Mar 6, 2018

Also I like the idea of shipping 2 options to begin with, I caused a lot of problems when I did this change initially because I completely ripped out the DOM-based renderer. It would have been worth the extra overhead to have an option for users to switch back.

Copy link
Member

@Tyriar Tyriar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overall idea behind the change looks good, just a note about the folders. The shared/ folder was created as a place to put code that could run in both a browser context and a web worker context, to allow future priming of the char atlas in a different thread and falling back when it's not supported by the browser.

Not sure we will ship web worker support any time soon but let's try stick to this rule in the meantime; basically anything inside shared/ can only reference other files inside shared/. So CHAR_ATLAS_CELL_SPACING for example should live inside shared/ and have the browser context parts pointing to it.

import { isFirefox } from '../shared/utils/Browser';
import { generateCharAtlas, ICharAtlasRequest } from '../shared/CharAtlasGenerator';
import { generateConfig, configEquals } from './atlas/CharAtlasUtils';

export const CHAR_ATLAS_CELL_SPACING = 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be removed?

import { IColorSet } from '../Types';

export const CHAR_ATLAS_CELL_SPACING = 1;
export const INVERTED_DEFAULT_COLOR = -1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like are being used anywhere.

@Tyriar Tyriar added this to the 3.3.0 milestone Mar 6, 2018
@Tyriar Tyriar self-assigned this Mar 6, 2018
bgw added 2 commits March 7, 2018 22:13
- Ensures that everything is only defined in one place, and everything
  imports from that place.
- Moves CHAR_ATLAS_CELL_SPACING into a subdirectory of shared/ so that
  CharAtlasGenerator can pull from it.

This addresses the comments on
https://github.com/xtermjs/xterm.js/pull/1307/files/454fd4bfb1ab5c9ece
Moves CharAtlas into src/renderer/atlas/ and CharAtlasGenerator into
src/shared/atlas/.
@bgw
Copy link
Member Author

bgw commented Mar 8, 2018

I've added a couple more commits that should address the comments.

On a somewhat related note: @Tyriar, how do you feel about using absolute imports everywhere?

@Tyriar
Copy link
Member

Tyriar commented Mar 8, 2018

On a somewhat related note: @Tyriar, how do you feel about using absolute imports everywhere?

I very much want this, created #1314 and made some notes in it.

@Tyriar
Copy link
Member

Tyriar commented Mar 8, 2018

Thanks again @bgw, looking forward to more in this area 😄

@Tyriar Tyriar merged commit 404a285 into xtermjs:master Mar 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants