mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-18 06:55:48 +03:00
Improve / Fix Font::isEmojiCodePoint (fixes loading some text codepoint as emoji codepoints).
Improve TextDocument::fileMightBeBinary to avoid some false-positives. Sanitize on load corrupted document line endings when \r\n are found but not expected. Improve HExtLanguageTypeHelper::detectLanguage to avoid allocating memory. Added String::readBySeparatorStoppable. Added SyntaxDefinitionManager::isFileFormatSupported.
This commit is contained in:
@@ -1087,10 +1087,18 @@ class EE_API String {
|
||||
std::function<void( std::string_view )> onSepChunkRead,
|
||||
char sep = '\n' );
|
||||
|
||||
static void readBySeparatorStoppable( std::string_view buf,
|
||||
std::function<bool( std::string_view )> onSepChunkRead,
|
||||
char sep = '\n' );
|
||||
|
||||
static void readBySeparator( String::View buf,
|
||||
std::function<void( String::View )> onSepChunkRead,
|
||||
String::StringBaseType sep = L'\n' );
|
||||
|
||||
static void readBySeparatorStoppable( String::View buf,
|
||||
std::function<bool( String::View )> onSepChunkRead,
|
||||
String::StringBaseType sep = L'\n' );
|
||||
|
||||
static size_t countLines( std::string_view text );
|
||||
|
||||
static size_t countLines( String::View text );
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace EE { namespace UI { namespace Doc {
|
||||
enum class HExtLanguageType { AutoDetect, C, CPP, ObjectiveC, ObjectiveCPP };
|
||||
|
||||
struct EE_API HExtLanguageTypeHelper {
|
||||
static HExtLanguageType detectLanguage( const std::string& buffer );
|
||||
static HExtLanguageType detectLanguage( std::string_view buffer );
|
||||
|
||||
static std::string toString( HExtLanguageType langType );
|
||||
|
||||
|
||||
@@ -37,10 +37,10 @@ class EE_API SyntaxDefinitionManager {
|
||||
const SyntaxDefinition& getByExtension( const std::string& filePath ) const;
|
||||
|
||||
const SyntaxDefinition&
|
||||
getByHeader( const std::string& header, const std::string& filePath = "",
|
||||
getByHeader( std::string_view header, const std::string& filePath = "",
|
||||
HExtLanguageType hLangType = HExtLanguageType::AutoDetect ) const;
|
||||
|
||||
const SyntaxDefinition& find( const std::string& filePath, const std::string& header,
|
||||
const SyntaxDefinition& find( const std::string& filePath, std::string_view header,
|
||||
HExtLanguageType hLangType = HExtLanguageType::AutoDetect );
|
||||
|
||||
const SyntaxDefinition& findFromString( const std::string_view& str ) const;
|
||||
@@ -84,6 +84,8 @@ class EE_API SyntaxDefinitionManager {
|
||||
|
||||
const std::map<std::string, std::string>& getLanguageExtensionsPriority();
|
||||
|
||||
bool isFileFormatSupported( const std::string& filePath, std::string_view header );
|
||||
|
||||
protected:
|
||||
SyntaxDefinitionManager( std::size_t reserveSpaceForLanguages = 12 );
|
||||
|
||||
@@ -95,8 +97,7 @@ class EE_API SyntaxDefinitionManager {
|
||||
std::optional<size_t> getLanguageIndex( const std::string& langName );
|
||||
|
||||
const SyntaxDefinition* needsHFallback( HExtLanguageType langType, const std::string& lspName,
|
||||
const std::string& ext,
|
||||
const std::string& buffer ) const;
|
||||
const std::string& ext, std::string_view buffer ) const;
|
||||
};
|
||||
|
||||
}}} // namespace EE::UI::Doc
|
||||
|
||||
Reference in New Issue
Block a user