Get new theme structure working

* Fix precedence of extends directives
* Always group color with font properties for text theming

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld
2021-08-04 14:07:19 -07:00
co-authored by Nathan Sobo
parent 5761756fb4
commit 802f1f4e78
15 changed files with 309 additions and 320 deletions
+4 -4
View File
@@ -4,7 +4,7 @@ use super::{
};
use crate::{
editor::buffer,
settings::StyleId,
settings::HighlightId,
sum_tree::{self, Cursor, FilterCursor, SumTree},
time,
util::Bias,
@@ -1004,12 +1004,12 @@ impl<'a> Iterator for Chunks<'a> {
pub struct HighlightedChunks<'a> {
transform_cursor: Cursor<'a, Transform, FoldOffset, usize>,
buffer_chunks: buffer::HighlightedChunks<'a>,
buffer_chunk: Option<(usize, &'a str, StyleId)>,
buffer_chunk: Option<(usize, &'a str, HighlightId)>,
buffer_offset: usize,
}
impl<'a> Iterator for HighlightedChunks<'a> {
type Item = (&'a str, StyleId);
type Item = (&'a str, HighlightId);
fn next(&mut self) -> Option<Self::Item> {
let transform = if let Some(item) = self.transform_cursor.item() {
@@ -1031,7 +1031,7 @@ impl<'a> Iterator for HighlightedChunks<'a> {
self.transform_cursor.next(&());
}
return Some((output_text, StyleId::default()));
return Some((output_text, HighlightId::default()));
}
// Retrieve a chunk from the current location in the buffer.
+3 -3
View File
@@ -1,7 +1,7 @@
use parking_lot::Mutex;
use super::fold_map::{self, FoldEdit, FoldPoint, Snapshot as FoldSnapshot};
use crate::{editor::rope, settings::StyleId, util::Bias};
use crate::{editor::rope, settings::HighlightId, util::Bias};
use std::{mem, ops::Range};
pub struct TabMap(Mutex<Snapshot>);
@@ -416,14 +416,14 @@ impl<'a> Iterator for Chunks<'a> {
pub struct HighlightedChunks<'a> {
fold_chunks: fold_map::HighlightedChunks<'a>,
chunk: &'a str,
style_id: StyleId,
style_id: HighlightId,
column: usize,
tab_size: usize,
skip_leading_tab: bool,
}
impl<'a> Iterator for HighlightedChunks<'a> {
type Item = (&'a str, StyleId);
type Item = (&'a str, HighlightId);
fn next(&mut self) -> Option<Self::Item> {
if self.chunk.is_empty() {
+4 -4
View File
@@ -5,7 +5,7 @@ use super::{
};
use crate::{
editor::Point,
settings::StyleId,
settings::HighlightId,
sum_tree::{self, Cursor, SumTree},
util::Bias,
Settings,
@@ -59,7 +59,7 @@ pub struct Chunks<'a> {
pub struct HighlightedChunks<'a> {
input_chunks: tab_map::HighlightedChunks<'a>,
input_chunk: &'a str,
style_id: StyleId,
style_id: HighlightId,
output_position: WrapPoint,
max_output_row: u32,
transforms: Cursor<'a, Transform, WrapPoint, TabPoint>,
@@ -487,7 +487,7 @@ impl Snapshot {
HighlightedChunks {
input_chunks: self.tab_snapshot.highlighted_chunks(input_start..input_end),
input_chunk: "",
style_id: StyleId::default(),
style_id: HighlightId::default(),
output_position: output_start,
max_output_row: rows.end,
transforms,
@@ -670,7 +670,7 @@ impl<'a> Iterator for Chunks<'a> {
}
impl<'a> Iterator for HighlightedChunks<'a> {
type Item = (&'a str, StyleId);
type Item = (&'a str, HighlightId);
fn next(&mut self) -> Option<Self::Item> {
if self.output_position.row() >= self.max_output_row {