MauiKit Terminal

konsole_wcwidth.h
1// SPDX-FileCopyrightText: Markus Kuhn
2// SPDX-License-Identifier: CC0-1.0
3
4#pragma once
5
6#include <QStringView>
7
8inline int konsole_wcwidth(QChar ucs)
9{
10 return wcwidth(ucs.unicode());
11}
12
13// single byte char: +1, multi byte char: +2
14inline int string_width(QStringView str)
15{
16 int w = 0;
17 for (auto c : str) {
18 w += konsole_wcwidth(c);
19 }
20 return w;
21}
char16_t & unicode()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 26 2024 11:57:30 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.