Skip to content

Commit 5e88bcd

Browse files
committed
Some bits after rebase
1 parent d0df17d commit 5e88bcd

File tree

11 files changed

+51
-56
lines changed

11 files changed

+51
-56
lines changed

src/contour/Config.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
#include <fstream>
1616
#include <iostream>
1717

18-
#include "Config.h"
19-
#include "contour/ConfigDocumentation.h"
20-
2118
#if defined(_WIN32)
2219
#include <Windows.h>
2320
#elif defined(__APPLE__)
@@ -1399,6 +1396,8 @@ std::optional<vtbackend::MatchModes> YAMLConfigReader::parseMatchModes(YAML::Nod
13991396
std::string const upperArg = crispy::toUpper(arg);
14001397
if (upperArg == "ALT")
14011398
flag = MatchModes::AlternateScreen;
1399+
if (upperArg == "ALTSCREEN")
1400+
flag = MatchModes::AlternateScreen;
14021401
else if (upperArg == "APPCURSOR")
14031402
flag = MatchModes::AppCursor;
14041403
else if (upperArg == "APPKEYPAD")

src/contour/Config.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@
6060
#include <unordered_map>
6161
#include <variant>
6262

63-
#include "ConfigDocumentation.h"
64-
6563
namespace contour::config
6664
{
6765

@@ -204,7 +202,9 @@ struct ConfigEntry
204202
constexpr explicit ConfigEntry(T&& in): _value { std::forward<T>(in) } {}
205203

206204
template <typename F>
207-
constexpr explicit ConfigEntry(F&& in): _value { std::forward<F>(in) } {}
205+
constexpr explicit ConfigEntry(F&& in): _value { std::forward<F>(in) }
206+
{
207+
}
208208
//clang-format on
209209

210210
[[nodiscard]] constexpr T const& value() const { return _value; }
@@ -703,7 +703,7 @@ struct YAMLConfigReader
703703
{
704704
try
705705
{
706-
doc = YAML::LoadFile(configFile);
706+
doc = YAML::LoadFile(configFile.string());
707707
}
708708
catch (std::exception const& e)
709709
{
@@ -767,9 +767,7 @@ struct YAMLConfigReader
767767
}
768768
}
769769

770-
void loadFromEntry(YAML::Node const& node,
771-
std::string const& entry,
772-
std::chrono::milliseconds& where)
770+
void loadFromEntry(YAML::Node const& node, std::string const& entry, std::chrono::milliseconds& where)
773771
{
774772
if (auto const child = node[entry]; child)
775773
where = std::chrono::milliseconds(child.as<int>());
@@ -1024,6 +1022,7 @@ struct YAMLConfigWriter
10241022
case vtbackend::CursorShape::Underscore: return "underscore";
10251023
case vtbackend::CursorShape::Bar: return "bar";
10261024
};
1025+
return "unknown";
10271026
}();
10281027
auto const blinking = v.cursor.cursorDisplay == vtbackend::CursorDisplay::Blink ? true : false;
10291028
auto const blinkingInterval = v.cursor.cursorBlinkInterval.count();

src/contour/ConfigDocumentation.h

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace contour::config::documentation
88
template <std::size_t N>
99
struct StringLiteral
1010
{
11-
constexpr StringLiteral(const char (&str)[N]): value{} { std::copy_n(str, N, value); }
11+
constexpr StringLiteral(const char (&str)[N]): value {} { std::copy_n(str, N, value); }
1212

1313
char value[N]; // NOLINT
1414
};
@@ -422,28 +422,26 @@ constexpr StringLiteral Bell {
422422
"\n"
423423
};
424424

425-
426425
constexpr StringLiteral FrozenDecMode {
427-
"{comment} Defines a list of DEC modes to explicitly and permanently disable/enable support for.\n"
428-
"{comment}\n"
429-
"{comment} This is a developer-users-only option that may possibly help investigating problems.\n"
430-
"{comment} This option may also be used by regular users if they're asked to in order to disable\n"
431-
"{comment} a broken functionality. This is something we hardly try to avoid, of course.\n"
432-
"{comment}\n"
433-
"{comment} This can be an object with each key being the DEC mode number and its value a boolean,\n"
434-
"{comment} indicating whether this DEC mode is permanently set (enabled) or unset (disabled).\n"
435-
"{comment}\n"
436-
"{comment} Example:\n"
437-
"{comment}\n"
438-
"{comment} frozen_dec_modes:\n"
439-
"{comment} 2026: false\n"
440-
"{comment} 2027: true\n"
441-
"{comment}\n"
442-
"{comment} Default: (empty object)\n"
443-
"{comment}frozen_dec_modes:\n"
426+
"{comment} Defines a list of DEC modes to explicitly and permanently disable/enable support for.\n"
427+
"{comment}\n"
428+
"{comment} This is a developer-users-only option that may possibly help investigating problems.\n"
429+
"{comment} This option may also be used by regular users if they're asked to in order to disable\n"
430+
"{comment} a broken functionality. This is something we hardly try to avoid, of course.\n"
431+
"{comment}\n"
432+
"{comment} This can be an object with each key being the DEC mode number and its value a boolean,\n"
433+
"{comment} indicating whether this DEC mode is permanently set (enabled) or unset (disabled).\n"
434+
"{comment}\n"
435+
"{comment} Example:\n"
436+
"{comment}\n"
437+
"{comment} frozen_dec_modes:\n"
438+
"{comment} 2026: false\n"
439+
"{comment} 2027: true\n"
440+
"{comment}\n"
441+
"{comment} Default: (empty object)\n"
442+
"{comment}frozen_dec_modes:\n"
444443
};
445444

446-
447445
constexpr StringLiteral Live {
448446
"{comment} Determines whether the instance is reloading the configuration files "
449447
"whenever it is changing or not. \n"

src/contour/TerminalSession.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,7 @@ TerminalSession::TerminalSession(unique_ptr<vtpty::Pty> pty, ContourGuiApp& app)
194194
{
195195
if (app.liveConfig())
196196
{
197-
sessionLog()("Enable live configuration reloading of file {}.",
198-
_config.configFile.generic_string());
197+
sessionLog()("Enable live configuration reloading of file {}.", _config.configFile.generic_string());
199198
_configFileChangeWatcher = make_unique<QFileSystemWatcher>();
200199
_configFileChangeWatcher->addPath(QString::fromStdString(_config.configFile.generic_string()));
201200
connect(_configFileChangeWatcher.get(),
@@ -1409,8 +1408,7 @@ void TerminalSession::spawnNewTerminal(string const& profileName)
14091408
if (_config.spawnNewProcess.value())
14101409
{
14111410
sessionLog()("spawning new process");
1412-
::contour::spawnNewTerminal(
1413-
_app.programPath(), _config.configFile.generic_string(), profileName, wd);
1411+
::contour::spawnNewTerminal(_app.programPath(), _config.configFile.generic_string(), profileName, wd);
14141412
}
14151413
else
14161414
{

src/contour/TerminalSessionManager.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ std::unique_ptr<vtpty::Pty> TerminalSessionManager::createPty()
3131
if (!profile->ssh.value().hostname.empty())
3232
return make_unique<vtpty::SshSession>(profile->ssh.value());
3333
#endif
34-
return make_unique<vtpty::Process>(profile->shell.value(), vtpty::createPty(profile->terminalSize.value(), nullopt));
34+
return make_unique<vtpty::Process>(profile->shell.value(),
35+
vtpty::createPty(profile->terminalSize.value(), nullopt));
3536
}
3637

3738
TerminalSession* TerminalSessionManager::createSession()

src/contour/display/TerminalDisplay.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -579,13 +579,12 @@ void TerminalDisplay::createRenderer()
579579
windowSize.height());
580580
}
581581

582-
_renderTarget = new OpenGLRenderer(
583-
builtinShaderConfig(ShaderClass::Text),
584-
builtinShaderConfig(ShaderClass::Background),
585-
precalculatedViewSize,
586-
precalculatedTargetSize,
587-
textureTileSize,
588-
viewportMargin);
582+
_renderTarget = new OpenGLRenderer(builtinShaderConfig(ShaderClass::Text),
583+
builtinShaderConfig(ShaderClass::Background),
584+
precalculatedViewSize,
585+
precalculatedTargetSize,
586+
textureTileSize,
587+
viewportMargin);
589588
_renderTarget->setWindow(window());
590589
_renderer->setRenderTarget(*_renderTarget);
591590

@@ -978,8 +977,9 @@ void TerminalDisplay::updateMinimumSize()
978977
assert(_session);
979978

980979
auto constexpr MinimumTotalPageSize = PageSize { LineCount(5), ColumnCount(10) };
981-
auto const minimumSize = computeRequiredSize(
982-
_session->profile().margins.value(), _renderer->cellSize() * (1.0 / contentScale()), MinimumTotalPageSize);
980+
auto const minimumSize = computeRequiredSize(_session->profile().margins.value(),
981+
_renderer->cellSize() * (1.0 / contentScale()),
982+
MinimumTotalPageSize);
983983

984984
window()->setMinimumSize(QSize(unbox<int>(minimumSize.width), unbox<int>(minimumSize.height)));
985985
}
@@ -990,7 +990,7 @@ vtbackend::RefreshRate TerminalDisplay::refreshRate() const
990990
{
991991
auto* const screen = window()->screen();
992992
if (!screen)
993-
return { vtbackend::RefreshRate { 30.0 } };
993+
return { vtbackend::RefreshRate { 30.0 } };
994994

995995
auto const systemRefreshRate = vtbackend::RefreshRate { static_cast<double>(screen->refreshRate()) };
996996
return systemRefreshRate;

src/contour/display/TerminalDisplay.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,10 @@ class TerminalDisplay: public QQuickItem
223223
// auto const availablePixels = gridMetrics().cellSize * _session->terminal().pageSize();
224224
auto const availablePixels = vtbackend::ImageSize { vtbackend::Width::cast_from(width()),
225225
vtbackend::Height::cast_from(height()) };
226-
return pageSizeForPixels(availablePixels,
227-
_renderer->gridMetrics().cellSize,
228-
applyContentScale(_session->profile().margins.value(), _session->contentScale()));
226+
return pageSizeForPixels(
227+
availablePixels,
228+
_renderer->gridMetrics().cellSize,
229+
applyContentScale(_session->profile().margins.value(), _session->contentScale()));
229230
}
230231

231232
void updateMinimumSize();

src/contour/helper.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -621,10 +621,11 @@ void applyResize(vtbackend::ImageSize newPixelSize,
621621
if (renderer.hasRenderTarget())
622622
renderer.renderTarget().setRenderSize(newPixelSize);
623623
renderer.setPageSize(newPageSize);
624-
renderer.setMargin(computeMargin(renderer.gridMetrics().cellSize,
625-
newPageSize,
626-
newPixelSize,
627-
applyContentScale(session.profile().margins.value(), session.contentScale())));
624+
renderer.setMargin(
625+
computeMargin(renderer.gridMetrics().cellSize,
626+
newPageSize,
627+
newPixelSize,
628+
applyContentScale(session.profile().margins.value(), session.contentScale())));
628629

629630
if (oldPageSize.lines != newPageSize.lines)
630631
emit session.lineCountChanged(newPageSize.lines.as<int>());

src/contour/helper.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,7 @@ void spawnNewTerminal(std::string const& programPath,
167167

168168
vtbackend::FontDef getFontDefinition(vtrasterizer::Renderer& renderer);
169169

170-
constexpr config::WindowMargins applyContentScale(
171-
config::WindowMargins margins, double contentScale) noexcept
170+
constexpr config::WindowMargins applyContentScale(config::WindowMargins margins, double contentScale) noexcept
172171
{
173172
return { .horizontal = static_cast<unsigned>(margins.horizontal * contentScale),
174173
.vertical = static_cast<unsigned>(margins.vertical * contentScale) };

src/text_shaper/font.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ struct font_description
176176
font_spacing spacing = font_spacing::proportional;
177177
bool strictSpacing = false; // TODO Default value used in config.h while loading fonts
178178

179-
std::vector<font_feature> features;
179+
std::vector<font_feature> features {};
180180

181181
// returns "familyName [weight] [slant]"
182182
[[nodiscard]] std::string toPattern() const;

0 commit comments

Comments
 (0)