Skip to content

Commit

Permalink
Merge branch 'FarGroup:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
deep-soft authored Sep 1, 2024
2 parents 4156d79 + e086397 commit 12f9258
Show file tree
Hide file tree
Showing 75 changed files with 881 additions and 428 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ jobs:
with:
update: true
msystem: ${{ matrix.sys }}
install: unzip
pacboy: toolchain:p

- name: Setup clang build
Expand Down
6 changes: 4 additions & 2 deletions far/FarCze.hlf.m4
Original file line number Diff line number Diff line change
Expand Up @@ -4437,7 +4437,7 @@ $ #Color Picker#

The foreground and the background colors can be either:
- one of the 16 colors from the standard Windows Console pallete,
- one of the 256 colors from the Xterm pallette, or
- one of the 256 colors from the ANSI pallette, or
- one of the 16 million colors from the RGB color space.

The standard 16-color palette is available in the dialog.
Expand All @@ -4451,6 +4451,8 @@ $ #Color Picker#
- #______##### - the palette index from 00 to FF.
- #__RRGGBB# - the red, green and blue channels in the RGB color space, from 00 to FF each.

Palette indices 00-0F are arranged in Windows/DOS/CGA/IBM PC order, not ANSI (e.g. color ##1 is blue, not red).

When the color is not fully opaque, the previous color in the logical Z-order is taken into account.

The foreground text style can include ANSI/VT100-like attributes listed in the right section.
Expand Down Expand Up @@ -4484,7 +4486,7 @@ You can find more about it ~here~@https://docs.microsoft.com/en-us/windows/conso

@ColorPicker256
$ #256 Color Picker#
This dialog allows to pick a color from the 256-color Xterm pallette.
This dialog allows to pick a color from the 256-color ANSI pallette.

The first 16 colors are the same as the standard palette and are available in the ~main dialog~@ColorPicker@.

Expand Down
6 changes: 4 additions & 2 deletions far/FarEng.hlf.m4
Original file line number Diff line number Diff line change
Expand Up @@ -4404,7 +4404,7 @@ $ #Color Picker#

The foreground and the background colors can be either:
- one of the 16 colors from the standard Windows Console pallete,
- one of the 256 colors from the Xterm pallette, or
- one of the 256 colors from the ANSI pallette, or
- one of the 16 million colors from the RGB color space.

The standard 16-color palette is available in the dialog.
Expand All @@ -4418,6 +4418,8 @@ $ #Color Picker#
- #______##### - the palette index from 00 to FF.
- #__RRGGBB# - the red, green and blue channels in the RGB color space, from 00 to FF each.

Palette indices 00-0F are arranged in Windows/DOS/CGA/IBM PC order, not ANSI (e.g. color ##1 is blue, not red).

When the color is not fully opaque, the previous color in the logical Z-order is taken into account.

The foreground text style can include ANSI/VT100-like attributes listed in the right section.
Expand Down Expand Up @@ -4451,7 +4453,7 @@ You can find more about it ~here~@https://docs.microsoft.com/en-us/windows/conso

@ColorPicker256
$ #256 Color Picker#
This dialog allows to pick a color from the 256-color Xterm pallette.
This dialog allows to pick a color from the 256-color ANSI pallette.

The first 16 colors are the same as the standard palette and are available in the ~main dialog~@ColorPicker@.

Expand Down
6 changes: 4 additions & 2 deletions far/FarGer.hlf.m4
Original file line number Diff line number Diff line change
Expand Up @@ -4489,7 +4489,7 @@ $ #Color Picker#

The foreground and the background colors can be either:
- one of the 16 colors from the standard Windows Console pallete,
- one of the 256 colors from the Xterm pallette, or
- one of the 256 colors from the ANSI pallette, or
- one of the 16 million colors from the RGB color space.

The standard 16-color palette is available in the dialog.
Expand All @@ -4503,6 +4503,8 @@ $ #Color Picker#
- #______##### - the palette index from 00 to FF.
- #__RRGGBB# - the red, green and blue channels in the RGB color space, from 00 to FF each.

Palette indices 00-0F are arranged in Windows/DOS/CGA/IBM PC order, not ANSI (e.g. color ##1 is blue, not red).

When the color is not fully opaque, the previous color in the logical Z-order is taken into account.

The foreground text style can include ANSI/VT100-like attributes listed in the right section.
Expand Down Expand Up @@ -4536,7 +4538,7 @@ You can find more about it ~here~@https://docs.microsoft.com/en-us/windows/conso

@ColorPicker256
$ #256 Color Picker#
This dialog allows to pick a color from the 256-color Xterm pallette.
This dialog allows to pick a color from the 256-color ANSI pallette.

The first 16 colors are the same as the standard palette and are available in the ~main dialog~@ColorPicker@.

Expand Down
6 changes: 4 additions & 2 deletions far/FarHun.hlf.m4
Original file line number Diff line number Diff line change
Expand Up @@ -4508,7 +4508,7 @@ $ #Color Picker#

The foreground and the background colors can be either:
- one of the 16 colors from the standard Windows Console pallete,
- one of the 256 colors from the Xterm pallette, or
- one of the 256 colors from the ANSI pallette, or
- one of the 16 million colors from the RGB color space.

The standard 16-color palette is available in the dialog.
Expand All @@ -4522,6 +4522,8 @@ $ #Color Picker#
- #______##### - the palette index from 00 to FF.
- #__RRGGBB# - the red, green and blue channels in the RGB color space, from 00 to FF each.

Palette indices 00-0F are arranged in Windows/DOS/CGA/IBM PC order, not ANSI (e.g. color ##1 is blue, not red).

When the color is not fully opaque, the previous color in the logical Z-order is taken into account.

The foreground text style can include ANSI/VT100-like attributes listed in the right section.
Expand Down Expand Up @@ -4555,7 +4557,7 @@ You can find more about it ~here~@https://docs.microsoft.com/en-us/windows/conso

@ColorPicker256
$ #256 Color Picker#
This dialog allows to pick a color from the 256-color Xterm pallette.
This dialog allows to pick a color from the 256-color ANSI pallette.

The first 16 colors are the same as the standard palette and are available in the ~main dialog~@ColorPicker@.

Expand Down
6 changes: 4 additions & 2 deletions far/FarPol.hlf.m4
Original file line number Diff line number Diff line change
Expand Up @@ -4412,7 +4412,7 @@ $ #Wybór kolorów#

Kolory wyświetlanych znaków i tła mogą być:
- jednym z 16 kolorów ze standardowej palety Konsoli Windows,
- jednym z 256 kolorów z palety Xterm, lub
- jednym z 256 kolorów z palety ANSI, lub
- jednym z 16 milionów kolorów z przestrzeni barw RGB.

Standardowa 16-kolorowa paleta jest dostępna w oknie dialogowym.
Expand All @@ -4427,6 +4427,8 @@ mogą go obsługiwać inaczej, np. renderować jako półprzezroczysty.
- #______##### - indeks palety od 00 do FF.
- #__RRGGBB# - kanały czerwony (Red), zielony (Green) i niebieski (Blue) z przestrzeni barw RGB, każdy od 00 do FF.

Palette indices 00-0F are arranged in Windows/DOS/CGA/IBM PC order, not ANSI (e.g. color ##1 is blue, not red).

Jeżeli kolor nie jest w pełni nieprzezroczysty, brany jest pod uwagę poprzedni kolor w logicznym porządku Z.

Styl tekstu pierwszoplanowego może zawierać atrybuty podobne do ANSI/VT100 wymienione po prawej stronie.
Expand Down Expand Up @@ -4461,7 +4463,7 @@ Więcej informacji znajdziesz ~tutaj~@https://docs.microsoft.com/en-us/windows/c

@ColorPicker256
$ #Wybór z 256 kolorów#
To okno dialogowe pozwala wybrać kolor z 256-kolorowej palety Xterm.
To okno dialogowe pozwala wybrać kolor z 256-kolorowej palety ANSI.

Pierwsze 16 kolorów są takie same, jak standardowa paleta dostępna w ~głównym oknie~@ColorPicker@.

Expand Down
6 changes: 4 additions & 2 deletions far/FarRus.hlf.m4
Original file line number Diff line number Diff line change
Expand Up @@ -4466,7 +4466,7 @@ $ #Color Picker#

The foreground and the background colors can be either:
- one of the 16 colors from the standard Windows Console pallete,
- one of the 256 colors from the Xterm pallette, or
- one of the 256 colors from the ANSI pallette, or
- one of the 16 million colors from the RGB color space.

The standard 16-color palette is available in the dialog.
Expand All @@ -4480,6 +4480,8 @@ $ #Color Picker#
- #______##### - the palette index from 00 to FF.
- #__RRGGBB# - the red, green and blue channels in the RGB color space, from 00 to FF each.

Palette indices 00-0F are arranged in Windows/DOS/CGA/IBM PC order, not ANSI (e.g. color ##1 is blue, not red).

When the color is not fully opaque, the previous color in the logical Z-order is taken into account.

The foreground text style can include ANSI/VT100-like attributes listed in the right section.
Expand Down Expand Up @@ -4513,7 +4515,7 @@ You can find more about it ~here~@https://docs.microsoft.com/en-us/windows/conso

@ColorPicker256
$ #256 Color Picker#
This dialog allows to pick a color from the 256-color Xterm pallette.
This dialog allows to pick a color from the 256-color ANSI pallette.

The first 16 colors are the same as the standard palette and are available in the ~main dialog~@ColorPicker@.

Expand Down
6 changes: 4 additions & 2 deletions far/FarSky.hlf.m4
Original file line number Diff line number Diff line change
Expand Up @@ -4399,7 +4399,7 @@ $ #Color Picker#

The foreground and the background colors can be either:
- one of the 16 colors from the standard Windows Console pallete,
- one of the 256 colors from the Xterm pallette, or
- one of the 256 colors from the ANSI pallette, or
- one of the 16 million colors from the RGB color space.

The standard 16-color palette is available in the dialog.
Expand All @@ -4413,6 +4413,8 @@ $ #Color Picker#
- #______##### - the palette index from 00 to FF.
- #__RRGGBB# - the red, green and blue channels in the RGB color space, from 00 to FF each.

Palette indices 00-0F are arranged in Windows/DOS/CGA/IBM PC order, not ANSI (e.g. color ##1 is blue, not red).

When the color is not fully opaque, the previous color in the logical Z-order is taken into account.

The foreground text style can include ANSI/VT100-like attributes listed in the right section.
Expand Down Expand Up @@ -4446,7 +4448,7 @@ You can find more about it ~here~@https://docs.microsoft.com/en-us/windows/conso

@ColorPicker256
$ #256 Color Picker#
This dialog allows to pick a color from the 256-color Xterm pallette.
This dialog allows to pick a color from the 256-color ANSI pallette.

The first 16 colors are the same as the standard palette and are available in the ~main dialog~@ColorPicker@.

Expand Down
6 changes: 4 additions & 2 deletions far/FarUkr.hlf.m4
Original file line number Diff line number Diff line change
Expand Up @@ -4473,7 +4473,7 @@ $ #Color Picker#

The foreground and the background colors can be either:
- one of the 16 colors from the standard Windows Console pallete,
- one of the 256 colors from the Xterm pallette, or
- one of the 256 colors from the ANSI pallette, or
- one of the 16 million colors from the RGB color space.

The standard 16-color palette is available in the dialog.
Expand All @@ -4487,6 +4487,8 @@ $ #Color Picker#
- #______##### - the palette index from 00 to FF.
- #__RRGGBB# - the red, green and blue channels in the RGB color space, from 00 to FF each.

Palette indices 00-0F are arranged in Windows/DOS/CGA/IBM PC order, not ANSI (e.g. color ##1 is blue, not red).

When the color is not fully opaque, the previous color in the logical Z-order is taken into account.

The foreground text style can include ANSI/VT100-like attributes listed in the right section.
Expand Down Expand Up @@ -4520,7 +4522,7 @@ You can find more about it ~here~@https://docs.microsoft.com/en-us/windows/conso

@ColorPicker256
$ #256 Color Picker#
This dialog allows to pick a color from the 256-color Xterm pallette.
This dialog allows to pick a color from the 256-color ANSI pallette.

The first 16 colors are the same as the standard palette and are available in the ~main dialog~@ColorPicker@.

Expand Down
2 changes: 1 addition & 1 deletion far/PluginA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ static std::span<oldfar::PluginPanelItem> ConvertPanelItemsArrayToAnsi(std::span

static void FreeUnicodePanelItem(PluginPanelItem *PanelItem, size_t ItemsNumber)
{
FreePluginPanelItemsData(std::span(PanelItem, ItemsNumber));
FreePluginPanelItemsData({ PanelItem, ItemsNumber });

delete[] PanelItem;
}
Expand Down
33 changes: 33 additions & 0 deletions far/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
--------------------------------------------------------------------------------
drkns 2024-08-31 13:02:11+01:00 - build 6366

1. Improve shadow rendering.

--------------------------------------------------------------------------------
drkns 2024-08-30 22:15:07+01:00 - build 6365

1. Extend character width detection to support arbitrary values.

2. Extend 6348.1 to classic rendering.

3. Refactoring.

--------------------------------------------------------------------------------
drkns 2024-08-24 11:06:55+01:00 - build 6364

1. Correction of 6362.1.

--------------------------------------------------------------------------------
drkns 2024-08-24 00:55:19+01:00 - build 6363

1. Correction of 6362.2.

--------------------------------------------------------------------------------
drkns 2024-08-23 23:13:12+01:00 - build 6362

1. Read palette via VT.

2. Extend palette operations to 256 colors.

3. Refactoring.

--------------------------------------------------------------------------------
drkns 2024-08-19 17:15:46+01:00 - build 6361

Expand Down
46 changes: 30 additions & 16 deletions far/char_width.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ namespace

auto s_FullWidthState = full_width::off;

enum class codepoint_width: char
enum class codepoint_width: signed char
{
ambiguous,
narrow,
wide,
ambiguous = -1,
narrow = 1,
wide = 2,
};

[[nodiscard]]
Expand Down Expand Up @@ -417,12 +417,16 @@ namespace
[[nodiscard]]
auto device_width(char_width::codepoint const Codepoint, bool const ClearCacheOnly = false)
{
static std::array<codepoint_width, std::numeric_limits<char16_t>::max()> FastCache;
static std::array<uint8_t, std::numeric_limits<char16_t>::max()> FastCache;
static std::unordered_map<char_width::codepoint, codepoint_width> SlowCache;

// The static array above is 0-initialized by default, so we need to adjust accordingly
auto to_raw = [](codepoint_width const Width){ return static_cast<uint8_t>(std::to_underlying(Width) + 1); };
auto from_raw = [](uint8_t const Width){ return static_cast<codepoint_width>(Width - 1); };

if (ClearCacheOnly)
{
FastCache.fill(codepoint_width::ambiguous);
FastCache.fill(to_raw(codepoint_width::ambiguous));
SlowCache.clear();
console.ClearWideCache();
return codepoint_width::ambiguous;
Expand All @@ -432,18 +436,21 @@ namespace

if (IsBMP)
{
if (FastCache[Codepoint] != codepoint_width::ambiguous)
return FastCache[Codepoint];
if (const auto Width = from_raw(FastCache[Codepoint]); Width != codepoint_width::ambiguous)
return Width;
}
else
{
if (const auto Iterator = SlowCache.find(Codepoint); Iterator != SlowCache.cend())
return Iterator->second;
}

const auto Result = console.IsWidePreciseExpensive(Codepoint)? codepoint_width::wide : codepoint_width::narrow;
const auto Result = static_cast<codepoint_width>(console.GetWidthPreciseExpensive(Codepoint));

(IsBMP? FastCache[Codepoint] : SlowCache[Codepoint]) = Result;
if (IsBMP)
FastCache[Codepoint] = to_raw(Result);
else
SlowCache[Codepoint] = Result;

return Result;
}
Expand Down Expand Up @@ -477,25 +484,31 @@ namespace
namespace char_width
{
[[nodiscard]]
bool is_wide(codepoint const Codepoint)
size_t get(codepoint const Codepoint)
{
switch (s_FullWidthState)
{
default:
case full_width::off:
return !is_bmp(Codepoint);
return 1;

case full_width::automatic:
if (!is_fullwidth_needed())
return false;
return 1;

[[fallthrough]];

case full_width::on:
return get_width(Codepoint) == codepoint_width::wide;
return static_cast<size_t>(get_width(Codepoint));
}
}

[[nodiscard]]
bool is_wide(codepoint const Codepoint)
{
return get(Codepoint) > 1;
}

void enable(int const Value)
{
switch (Value)
Expand Down Expand Up @@ -527,6 +540,7 @@ namespace char_width
(void)device_width(0, true);
}

[[nodiscard]]
bool is_half_width_surrogate_broken()
{
// As of 23 Jun 2022 conhost and WT render half-width surrogates as half-width,
Expand All @@ -535,7 +549,7 @@ namespace char_width
// They might fix it eventually, so it's better to detect it dynamically.

// Mathematical Bold Fraktur Small A, U+1D586, half-width
static const auto Result = console.IsWidePreciseExpensive(U'𝖆');
return Result;
static const auto Result = console.GetWidthPreciseExpensive(U'𝖆');
return Result > 1;
}
}
Loading

0 comments on commit 12f9258

Please sign in to comment.